ObjecTips

基本Objective-Cで iOS とか OS X とか

フォトライブラリへの動画保存メソッド まとめ

PHAssetChangeRequest.h (iOS 8以降)

+ (instancetype)creationRequestForAssetFromVideoAtFileURL:(NSURL *)fileURL;

PHPhotoLibraryperformChanges:completionHandler: または performChangesAndWait:error: メソッドと組み合わせて使用する。


ALAsset.h

- (void)writeModifiedVideoAtPathToSavedPhotosAlbum:(NSURL *)videoPathURL completionBlock:(ALAssetsLibraryWriteVideoCompletionBlock)completionBlock __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0);

既存アセットの内容を書き換え

- (void)setVideoAtPath:(NSURL *)videoPathURL completionBlock:(ALAssetsLibraryWriteVideoCompletionBlock)completionBlock __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0);


ALAssetsLibrary.h

- (void)writeVideoAtPathToSavedPhotosAlbum:(NSURL *)videoPathURL completionBlock:(ALAssetsLibraryWriteVideoCompletionBlock)completionBlock;


UIImagePickerController.h

UIKIT_EXTERN void UISaveVideoAtPathToSavedPhotosAlbum(NSString *videoPath, id completionTarget, SEL completionSelector, void *contextInfo) NS_AVAILABLE_IOS(3_1);