使用Cordova 2.1.0進行IOS應用程序開發。 我已經出發,按照MainViewController.m文件我shouldStartLoadWithRequest功能:AppDelegate.m文件中的函數未從MainViewController.m文件調用
- (BOOL)webView:(UIWebView *)webView2
shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSLog(@"shouldStartLoadWithRequest function");
// Intercept custom location change, URL begins with "js-call:"
if ([[[request URL] absoluteString] hasPrefix:@"js-call:"]) {
// Call the given selector
[self performSelector:NSSelectorFromString(@"resetBadgeCount")];
// Cancel the location change
return NO;
}
// Accept this location change
return YES;
}
的事情是,在我的index.html我有以下: - 了window.location = 「JS調用:resetBadgeCount」;
但resetBadgeCount是存在於AppDelegate.m文件中的函數,每當shouldStartLoadWithRequest函數被調用,它給出了這樣的錯誤:
-[MainViewController resetBadgeCount]: unrecognized selector sent to instance 0x199db0
所以,我應如何改變這樣的錯誤抑制代碼和resetBadgeCount功能是成功的調用。