写真フレームワークを使用して画像を保存しようとすると、毎回アプリがクラッシュします。
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
_mChangeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:[info valueForKey:UIImagePickerControllerOriginalImage]];
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
_mChangeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:[info valueForKey:UIImagePickerControllerOriginalImage]];
} completionHandler:^(BOOL success, NSError *error) {
if (success) {
PHObjectPlaceholder *assetPlaceholder = _mChangeRequest.placeholderForCreatedAsset;
}
else {
NSLog(@"write error : %@",error);
}
}];
}
crash : NSInternalInconsistencyException', reason: 'This method can only be called from inside of -[PHPhotoLibrary performChanges:completionHandler:] or -[PHPhotoLibrary performChangesAndWait:error:]'