To prevent multitasking in your app, modify your [AppName]-Info.plist, in Xcode just add a new value and it should be one of the new values in the dropdown..., check that off.
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
[[super webView] stringByEvaluatingJavaScriptFromString:@"alert('yippikiyay')"];
One thing that's worked for me is to wrap the call (an alert, or a
different function call) in a simple setTimeout - this ensures that
the stringByEvaluatingJavaScriptFromString does not lock up
(setTimeout returns immediately, and the callback code isn't called
until the event loop is ready to handle it) and your code executes as
desired.
Sample here:
http://gist.github.com/491468
--
Andrew Lunny
Software Developer, Nitobi
604 685 9287
blogs.nitobi.com/andrew
Sent from my iPhone
document.addEventListener('appActive', function () {
alert('app is now active');
}, false);
Either that or replace the call within setTimeout on the Objective-C
side to call your appActive function directly:
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSString *fireActiveEvent = @"window.setTimeout(function() { \n"
"appActive(); \n"
"}, 1);";
[webView stringByEvaluatingJavaScriptFromString:fireActiveEvent];
}