I wanted to know how I could go about passing a Variable (cookie) in a local HTML file in my iOS App, and pass what the cookie says onto a UILabel. Here is what the HTML code is. I need to pass this message into a UILabel
<script language="javascript">setCookie('Test','You Sir have succeeded. Congratulations.', 300);
</script>
And here is my updated code for iOS app
Header File:
import
@interface ViewController : UIViewController {
IBOutlet UIWebView *webView;
IBOutlet UILabel *mylabel;
}
@end
Main File
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"DTPContent/cookietest" ofType:@"html"]isDirectory:NO]]];
[super viewDidLoad];
NSString *myCookie = [self->webView stringByEvaluatingJavaScriptFromString:@"getCookie('Test')"]; self->mylabel.text = myCookie;
}
@end
Thank You in Advance!