Nathan Nathan - 1 year ago 53
HTML Question

Is it possible to send a string from a local html file to NSUserDefaults in iOS?

For example, if I have an HTML page with a web login can I then store that information in the NSUserDefaults?

Any examples or tutorials would be greatly appreciated.

Thanks in advance...

jsd jsd
Answer Source

If you have the page loaded in a UIWebView the only way you can access content inside it is to use

-(NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script

To run some javascript that would output something as a string, which you could capture and store in NSUserDefaults like any other string. Without knowing exactly what info you need in that web view, it's hard to be more specific.