简体   繁体   中英

AVAssetWriter invalid URL for writing

I'm getting this error:

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

On this line:

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

Where videoURL logs as:

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

the line before this is called.

I've also tested against isFileURL myself and its returning NO. What is required to be a valid fileURL?

Use

+ (id)fileURLWithPath:(NSString *)path

instead of

+ (id)URLWithString:(NSString *)URLString

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM