【问题标题】:"Content URL must not be nil" error when playing video播放视频时出现“内容 URL 不得为零”错误
【发布时间】:2010-03-10 06:26:32
【问题描述】:

我在我的应用程序中播放本地文件中的视频,它可以正常工作,但突然播放视频后应用程序崩溃并出现以下错误:

2010-03-10 11:34:20.235 桑吉夫卡普尔[1560:20b] *** 由于未捕获而终止应用程序 例外 'NSInvalidArgumentException',原因: '内容 URL 不能为零。'

这是我遇到崩溃的代码:

-(void)initAndPlayMovie:(NSURL *)movieURL
{
   // Initialize a movie player object with the specified URL
   MPMoviePlayerController *mp = [[MPMoviePlayerController alloc]  initWithContentURL:movieURL];  // This line causes the crash
   if (movieURL)
   {
      . . .
   }
}

【问题讨论】:

  • 读取错误。提示非常明确。你需要传入一个有效的 NSURL 实例。

标签: iphone objective-c


【解决方案1】:

在检查它是否为 nil 之前,您正在将 movieURL 交给MPMoviePlayerController。您必须在检查后执行此操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-30
    • 1970-01-01
    • 2012-09-20
    • 1970-01-01
    • 1970-01-01
    • 2019-01-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多