Save photo to iPhone Photo album from dowloaded NSData object
I download the data from a URL of video in NSData form. Now how can I store it to iphone Photoalbum? Is there any way to convert NSData to video back or we can directly save开发者_JAVA百科 it to photo album?
If you can play the movie in a MPMoviePlayerController object then it should return true when checked by UIVideoAtPathIsCompatibleWithSavedPhotosAlbum().
If so, then you can save it to the Photo Library using this function:
void UISaveVideoAtPathToSavedPhotosAlbum (
NSString *videoPath,
id completionTarget,
SEL completionSelector,
void *contextInfo
);
Alternatively, you can create and ALAssetsLibrary object and save it using using the this method:
- (void)writeVideoAtPathToSavedPhotosAlbum:(NSURL *)videoPathURL completionBlock:(ALAssetsLibraryWriteVideoCompletionBlock)completionBlock
精彩评论