'invokeString'是Deprecated Phonegap / Cordova 2.1.0 Xcode 4.5

时间:2012-09-25 15:13:01

标签: ios xcode cordova childbrowser

  

可能重复:
  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];

}

0 个答案:

没有答案