可能重复:
cordova/phonegap 2.0 iOS
我刚刚升级到 Phonegap 2.1.0 和 Xcode 4.5,我收到警告消息,指出 MainViewController.m 中不推荐使用“invokeString”。我知道我需要使用 window.handleOpenURL(url) 函数。但是,我不确定我需要更改什么以及需要在哪里更改?我正在使用儿童浏览器,我相信这会导致它无法打开。
- (void) webViewDidFinishLoad:(UIWebView*) theWebView
{
// only valid if ___PROJECTNAME__-Info.plist specifies a protocol to handle
if (self.invokeString)
{
// this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
NSLog(@"DEPRECATED: window.invokeString - use the window.handleOpenURL(url) function instead, which is always called when the app is launched through a custom scheme url.");
NSString* jsString = [NSString stringWithFormat:@"var **invokeString = \"%@\";", self.invokeString];**
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
}
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
return [super webViewDidFinishLoad:theWebView];
}