11
對於iOS9,不建議使用ALAssetsLibrary
。那麼如何將其更改爲PHPPhotoLibrary
而不是ALAssets
?如何使用PHPhotoLibrary,如ALAssetsLibrary
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) {}];
}
}
這是正確的答案,你應該把它@deniz它給出錯誤無效URL標記爲這樣的:) – joey
。 –
assetURL如何?保存後如何獲得網址? – Besat