UIImagePickerControllerで撮った動画をアルバムに保存する

要するにUIImageWriteToSavedPhotosAlbumのムービー版。

void UISaveVideoAtPathToSavedPhotosAlbum (
   NSString  *videoPath,
   id        completionTarget,
   SEL       completionSelector,
   void      *contextInfo
);

UIKit Function Reference

UIImagePickerControllerはムービーの場所をNSURLで返すので、いいのか悪いのかしらないけどとりあえずこんなふうにしてみた。

NSString *moviePath = [[movieUrl absoluteString] 
                       stringByReplacingOccurrencesOfString:@"file://localhost" 
                       withString:@""];
UISaveVideoAtPathToSavedPhotosAlbum(moviePath, nil, nil, nil);

SDK3.1以上じゃないと使えないので注意。この関数見つけるのにえらい苦労したのでメモメモ。