2013-10-11 40 views
0

我使用下面的代碼來保存照片庫中的視頻,但它不工作IOS7。如何在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中存儲視頻的方法。提前致謝。

回答

-1

試試這個方法...

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

讓我知道,如果你有任何問題

+0

你試試這個? – user1673099

+0

這是我兄弟的工作。 – user1673099

+0

爲什麼有人投票給我? – user1673099