ios - 任务完成但出现错误 - 代码:-999 ios 使用 avplayer 播放视频
问题描述
我想制作一个演示应用程序,只需使用以下示例代码即可播放从网络加载的视频:
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:@"http://ftp.cp.108tian.com/video/unity_animation.mov"];
AVPlayer *avp = [[AVPlayer alloc]initWithURL:url];
AVPlayerViewController *avpc = [[AVPlayerViewController alloc]init];
avpc.player = avp;
[self presentViewController:avpc animated:YES completion:nil];
}
是的,我添加了AST
允许 HTTP 传输:
但我仍然收到此错误:
发生了什么?以及如何解决这个问题?
解决方案
Present
应该在viewDidAppear
/viewWillAppear
除了一个有效的 url
[self presentViewController:avpc animated:YES completion:nil];
推荐阅读
- c++ - 结构中指向数组的 cudaFree 指针上的 CUDA 分段错误
- linux - How to print output twice in Linux?
- django - Django Rest Framework not accepting JWT Authentication Token
- python - How to dynamically delete DAGs?
- node.js - Rewriting a NodeJS Website using Oracle APEX
- .htaccess - Allow 3 ip's, redirect for other ip's and redirect to mobile site
- c - 链接库还是将它们带到 test.c 代码所在的本地目录更好?
- reactjs - 反应和对象 - 类型错误:无法读取未定义的属性“地图”
- c# - Azure 函数 QueueTrigger 和 int 消息
- java - Java versions don't match between command prompt and STS