Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios YTPlayerView在模拟器中工作,但不在Objective C中的Iphone设备中工作_Ios_Objective C - Fatal编程技术网

Ios YTPlayerView在模拟器中工作,但不在Objective C中的Iphone设备中工作

Ios YTPlayerView在模拟器中工作,但不在Objective C中的Iphone设备中工作,ios,objective-c,Ios,Objective C,我的代码: @property(nonatomic, strong) IBOutlet YTPlayerView *playerView; [self.playerView loadWithVideoId:@"M7lc1UVf-VE"]; 我正在处理youtube上的playvideo。但这段代码在模拟器中运行得很好,但在设备中却不行。。任何人都知道出现此问题的原因。添加委派

我的代码:

    @property(nonatomic, strong) IBOutlet YTPlayerView *playerView;
    [self.playerView loadWithVideoId:@"M7lc1UVf-VE"];

我正在处理youtube上的playvideo。但这段代码在模拟器中运行得很好,但在设备中却不行。。任何人都知道出现此问题的原因。

添加
委派
委派
等方法

- (void)playerViewDidBecomeReady:(nonnull YTPlayerView *)playerView;
- (void)playerView:(nonnull YTPlayerView *)playerView receivedError:
- (YTPlayerError)error;

可能你可以在这里找到答案。

什么不起作用,你有错误吗?我从youtube上传的视频在模拟器中工作,但当我在iphone设备中运行时,它不会出错,只显示白色屏幕。你有没有逐级检查代码,
loadWithVideoId
是否执行时没有问题?是的,我尝试了loadWithVideoId执行时没有问题,但没有视频结果确保您的设备连接到了正确的internet…如果您连接了wifi,请确保wifi可以访问youtube视频