iMeMyself
iMeMyself

Reputation: 1649

How to insert html page (URL) to SQLite Database?

i am using couple of html pages which are loaded in UIWebView , there is a add to favorite button when clicked URL of the html page should be stored in SQLite Database.. how to do this ?
thanks in advance

Upvotes: 1

Views: 1155

Answers (1)

Mutawe
Mutawe

Reputation: 6524

you can save them in NSUserDefaults as follow:

Saving

 NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

// saving an NSString

[prefs setObject:@"TextToSave" forKey:@"keyToLookupString"];
[prefs synchronize];

Retrieving

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

// getting an NSString

 NSString *myString = [prefs stringForKey:@"keyToLookupString"];

then use it in your code to retrieve the URL of the html page

to link it with your webView :

NSString *myString = [prefs stringForKey:@"keyToLookupString"];
NSURL *url = [NSURL URLWithString:myString];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];

Upvotes: 1

Related Questions