So I have the following file which contains the following javascript
(function getradiovalue(myvalue)
{
alert(myvalue);
return myvalue;
})
My .m file contains the following
NSString thisinputradio = @"radio1";
NSString *tstr = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"getRadioValue" ofType:@"txt"] encoding:NSASCIIStringEncoding error: &error] ;
NSString *injectstr = [webView stringByEvaluatingJavaScriptFromString:tstr] ;
NSString *myjscript = [NSString stringWithFormat:@"getradiovalue('%@');", thisinputradio];
NSString *evalstr = [webView stringByEvaluatingJavaScriptFromString:myjscript] ;
This should throw my alert with the value that I have assigned to thisinputradio but I'm getting nothing. I threw an NSLog(@"%@", tstr); and it spits out the javascript code but when I evaluate the second half to pass a variable into the function i get squat. Any Help is much appreciated. I would like to be able to pass something into the getradiovalue function multiple times which is why I have it broken apart this way.