对于 iOS9,ALAssetsLibrary
已弃用。那么如何将其更改为PHPPhotoLibrary
而不是ALAssets
?
if (RecordedSuccessfully && recording == NO) {
//----- RECORDED SUCESSFULLY -----
NSLog(@"didFinishRecordingToOutputFileAtURL - success");
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:outputFileURL])
{
[library writeVideoAtPathToSavedPhotosAlbum:outputFileURL
completionBlock:^(NSURL *assetURL, NSError *error)
{
if (error)
{
}
}];
}
// 我试过这个,但没用
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest* createAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:outputFileURL];
NSParameterAssert(createAssetRequest);
}
completionHandler:^(BOOL success, NSError *error) {}];
}
}