Iphone 我可以使用此代码在模拟器上查看youtube视频吗?

Iphone 我可以使用此代码在模拟器上查看youtube视频吗?,iphone,objective-c,ios,uiwebview,youtube,Iphone,Objective C,Ios,Uiwebview,Youtube,我正在使用此代码查看youtube视频 - (YouTubeView *)initWithStringAsURL:(NSString *)urlString frame:(CGRect)frame; { if (self = [super init]) { // Create webview with requested frame size self = [[UIWebView alloc] initWithFrame:frame]; // HTML to emb

我正在使用此代码查看youtube视频

- (YouTubeView *)initWithStringAsURL:(NSString *)urlString frame:(CGRect)frame;
 {
if (self = [super init]) 
{
    // Create webview with requested frame size
    self = [[UIWebView alloc] initWithFrame:frame];

    // HTML to embed YouTube video
    NSString *youTubeVideoHTML = @"<html><head>\
    <body style=\"margin:0\">\
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
    width=\"%0.0f\" height=\"%0.0f\"></embed>\
    </body></html>";

    // Populate HTML with the URL and requested frame size
    NSString *html = [NSString stringWithFormat:youTubeVideoHTML, urlString, frame.size.width, frame.size.height];

    // Load the html into the webview
    [self loadHTMLString:html baseURL:nil];
}
return self;  
-(YouTubeView*)initWithStringAsURL:(NSString*)urlString frame:(CGRect)frame;
{
if(self=[super init])
{
//使用请求的帧大小创建webview
self=[[UIWebView alloc]initWithFrame:frame];
//HTML嵌入YouTube视频
NSString*youTubeVideoHTML=@”\
\
\
";
//使用URL和请求的帧大小填充HTML
NSString*html=[NSString stringWithFormat:youTubeVideoHTML,urlString,frame.size.width,frame.size.height];
//将html加载到webview中
[self-loadHTMLString:HtmlBaseURL:nil];
}
回归自我;
}

现在我在模拟器上看不到相关的视频,但是白色的网络视图出现了


那么有没有类似的东西我在模拟器上看不到youtube视频,或者代码中有任何其他问题?

你在模拟器上看不到youtube视频。如果显示白色webview,我认为您的代码可以正常工作


尝试在iPhone/iPod touch上安装。

在模拟器中看不到Youtube视频。如果显示白色webview,我认为您的代码可以正常工作

尝试在iPhone/iPod touch上安装