0

我使用以下代码将视频保存在照片库中,但它不适用于 IOS7。

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:urlVideo])
{
    [library writeVideoAtPathToSavedPhotosAlbum:urlVideo completionBlock:^(NSURL *assetURL, NSError *error){
        dispatch_async(dispatch_get_main_queue(), ^{
            if (error) {
                [self ShowMessage:@"Failed to create movie ! It may be due to video quality,please try again/"  andTitle:@"ERROR:" andButtonTitle:@"Close"];
                 [self EnableView];
            }
            else {
                [self ShowMessage:@"Movie created successfully" andTitle:@"Movie Status" andButtonTitle:@"Ok"];
                [self EnableView];
                }
             });
         }];
}

我也用过这个方法,但是这个方法在IOS7中也无法保存视频

UISaveVideoAtPathToSavedPhotosAlbum (exportPath, [GlobalMethods sharedInstance], @selector(video:didFinishSavingWithError:contextInfo:), nil);

请让我知道是否需要仅在此方法中进行任何修改,或者是否有任何其他方法可以在 IOS7 中存储视频。提前致谢。

4

1 回答 1

-1

试试这个方法...

#pragma mark - ImagePicker Controller Delegate
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
        NSString *sourcePath = [[info objectForKey:@"UIImagePickerControllerMediaURL"]relativePath];
    UISaveVideoAtPathToSavedPhotosAlbum(sourcePath,nil,nil,nil);
}

如果您有任何问题,请告诉我

于 2013-10-11T05:46:45.860 回答