我正在尝试在录制/拍照后保存视频/图像,但我收到“编写此资产时出现问题,因为数据无效且无法查看或播放”。
错误代码为-3302。问题是,在尝试保存数据之前,我并没有真正对数据做任何事情。 这是我运行的代码:
代码:
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
NSURL* mediaURL = [info objectForKey:UIImagePickerControllerMediaURL];
if(mediaURL)
{ //The user has recorded a video and it's kept on a temporary directory
if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum([mediaURL path]))
{
//Save the video to user library
UISaveVideoAtPathToSavedPhotosAlbum([mediaURL path], self, @selector(video:didFinishSavingWithError:context:), nil);
//Remove it from the temporary directory it was saved at
[[NSFileManager defaultManager] removeItemAtPath:[mediaURL path] error:nil];
}
}
}
就是这样。在尝试保存数据之前,我是否需要对数据执行某些操作?
感谢。