Objective c 按uiwebview时Youtube崩溃
我对Objective c 按uiwebview时Youtube崩溃,objective-c,ios7,uiwebview,youtube,crash,Objective C,Ios7,Uiwebview,Youtube,Crash,我对uiwebView中的Youtube视频有一些问题。当我试图播放视频时,应用程序崩溃了。但没有错误描述。这只是iOS 7中的情况。在iOS 6中,它可以正常工作。 我用这段代码创建了一个测试应用程序,它也可以工作。但在我的应用程序中没有播放。 哪里可能有错误?有人有想法吗 以下是我的网络视图: NSString*embedHtml=[NSString stringWithFormat:@”\ \ \ \ 正文{背景色:透明;}\ \ \ \ \ \ “,@“l3Iwh5hqbyE”,self
uiwebView
中的Youtube视频有一些问题。当我试图播放视频时,应用程序崩溃了。但没有错误描述。这只是iOS 7中的情况。在iOS 6中,它可以正常工作。
我用这段代码创建了一个测试应用程序,它也可以工作。但在我的应用程序中没有播放。
哪里可能有错误?有人有想法吗
以下是我的网络视图:
NSString*embedHtml=[NSString stringWithFormat:@”\
\
\
\
正文{背景色:透明;}\
\
\
\
\
\
“,@“l3Iwh5hqbyE”,self.testView.bounds.size.width-3,self.testView.bounds.size.height];
[self.testView loadHTMLString:EmbedHtmlBaseURL:nil];
我的应用程序设置有问题。也不能使用MPMoviePlayerViewController和XCDYouTubeVideoPlayerViewController。所有这些都在另一个项目中完美地工作。那么解决方案是什么呢?您在设置中更改了什么?我有一个UIButton类别,在当前UIView控制器中使用。此类别的方法“init”与UIWebView冲突。删除这个之后,我很高兴。
NSString *embedHtml = [NSString stringWithFormat:@"\
<html>\
<head>\
<style type=\"text/css\">\
body {background-color: transparent;}\
</style>\
</head>\
<body style=\"margin:0\">\
<iframe src=\"http://www.youtube.com/embed/%@\" width=\"%f\" height=\"%f\"></iframe>\
</body>\
</html>", @"l3Iwh5hqbyE", self.testView.bounds.size.width-3, self.testView.bounds.size.height];
[self.testView loadHTMLString:embedHtml baseURL:nil];