【问题标题】:AVAssetWriter invalid URL for writingAVAssetWriter 写入的 URL 无效
【发布时间】:2012-08-16 15:46:34
【问题描述】:

我收到此错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVAssetWriter initWithURL:fileType:error:] invalid parameter not satisfying: [outputURL isFileURL]'

在这一行:

AVAssetWriter * assetWriter = [[AVAssetWriter alloc] initWithURL:videoURL
                                                        fileType: AVFileTypeMPEG4
                                                           error: &movieError];

videoURL 记录为:

/var/mobile/Applications/A032EEA6-C83D-49DA-B118-E4E4B9F41C7F/Documents/videoForSegmentNumber1.mp4

调用此之前的行。

我自己也针对 isFileURL 进行了测试,它返回 NO。什么是有效的 fileURL?

【问题讨论】:

  • 你在使用+ (id)fileURLWithPath:(NSString *)path NSURL 方法吗?如果您能向我们展示您是如何创建 URL 的,那就太好了:)
  • 我正在使用 URLWithString:。看起来那是错误。谢谢!

标签: objective-c ios nsurl


【解决方案1】:

使用

+ (id)fileURLWithPath:(NSString *)path

而不是

+ (id)URLWithString:(NSString *)URLString

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    • 1970-01-01
    • 2020-10-20
    • 2013-03-08
    相关资源
    最近更新 更多