使用未声明的标识符'myWebMain'?(use of undeclared identifier 'myWebMain'?)

我正在研究一个cordova应用程序,我试图让itml上的html5自动播放,因为它被苹果禁用,我正在使用以下代码。

- (void)webViewDidFinishLoad:(UIWebView*)webView { NSURLRequest* request = [webView request]; NSString *page = [request.URL lastPathComponent]; if ([page isEqualToString:@"index.html"]){ NSString *js = @"startVideo();"; [myWebMain stringByEvaluatingJavaScriptFromString:js];

但是当我运行应用程序时,我收到此错误消息

使用未声明的标识符'myWebMain'

我对xcode一无所知,我想知道如何解决我的问题?

I'm working on a cordova app and im trying to get html5 on ios to autoplay since it was disable by apple, i'm using the following codes.

- (void)webViewDidFinishLoad:(UIWebView*)webView { NSURLRequest* request = [webView request]; NSString *page = [request.URL lastPathComponent]; if ([page isEqualToString:@"index.html"]){ NSString *js = @"startVideo();"; [myWebMain stringByEvaluatingJavaScriptFromString:js];

but when i run the app i get this error message

use of undeclared identifier 'myWebMain'

I have no knowledge on xcode, and i was wondering how can i fix my problem?

最满意答案

只需将myWebMain更改为webView

[webView stringByEvaluatingJavaScriptFromString:js];

just change myWebMain to webView

[webView stringByEvaluatingJavaScriptFromString:js];使用未声明的标识符'myWebMain'?(use of undeclared identifier 'myWebMain'?)

我正在研究一个cordova应用程序,我试图让itml上的html5自动播放,因为它被苹果禁用,我正在使用以下代码。

- (void)webViewDidFinishLoad:(UIWebView*)webView { NSURLRequest* request = [webView request]; NSString *page = [request.URL lastPathComponent]; if ([page isEqualToString:@"index.html"]){ NSString *js = @"startVideo();"; [myWebMain stringByEvaluatingJavaScriptFromString:js];

但是当我运行应用程序时,我收到此错误消息

使用未声明的标识符'myWebMain'

我对xcode一无所知,我想知道如何解决我的问题?

I'm working on a cordova app and im trying to get html5 on ios to autoplay since it was disable by apple, i'm using the following codes.

- (void)webViewDidFinishLoad:(UIWebView*)webView { NSURLRequest* request = [webView request]; NSString *page = [request.URL lastPathComponent]; if ([page isEqualToString:@"index.html"]){ NSString *js = @"startVideo();"; [myWebMain stringByEvaluatingJavaScriptFromString:js];

but when i run the app i get this error message

use of undeclared identifier 'myWebMain'

I have no knowledge on xcode, and i was wondering how can i fix my problem?

最满意答案

只需将myWebMain更改为webView

[webView stringByEvaluatingJavaScriptFromString:js];

just change myWebMain to webView

[webView stringByEvaluatingJavaScriptFromString:js];