【发布时间】:2013-09-23 06:29:03
【问题描述】:
每当我按下按钮时,我都想将 youtube 视频嵌入到网络查看器中。我有这个代码
- (IBAction)testBtn:(id)sender {
NSString *code = @"<iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/1iBIcJFRLBA\" frameborder=\"0\" allowfullscreen></iframe>";
[[self youtubeWebPlayer]loadHTMLString:code baseURL:nil];
}
我的问题是,每当我按下按钮时,什么都没有发生。网络查看器保持空白。
我在代码中放置了断点,以仔细检查代码是否被我的应用调用并且确实被调用了。
编辑***
我已经通过替换解决了这个问题
[[self youtubeWebPlayer]loadHTMLString:code baseURL:nil];
与
[[self youtubeWebPlayer]loadHTMLString:code baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];
【问题讨论】:
标签: iphone objective-c youtube ios-simulator