Nathan Nathan - 18 days ago 6
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

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.