0
我正在相機膠捲中創建特定相冊..但是對於我的每一次運行,它都會在相機膠捲中創建一個新相冊,而不是將視頻放在同一個相冊中。想法?將視頻放入相機膠捲中的一個特定相冊
__block PHObjectPlaceholder *assetCollectionPlaceholder;
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
// Create new album.
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCollectionChangeRequest *createAlbumRequest = [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:@"Eye Movement"];
assetCollectionPlaceholder = createAlbumRequest.placeholderForCreatedAssetCollection;
} completionHandler:^(BOOL success, NSError *error) {
if (success) {
PHFetchResult *fetchResult = [PHAssetCollection fetchAssetCollectionsWithLocalIdentifiers:@[assetCollectionPlaceholder.localIdentifier] options:nil];
PHAssetCollection *assetCollection = fetchResult.firstObject;
// Add it to the photo library
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest* createAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:outputFileURL];
PHAssetCollectionChangeRequest* assetRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:assetCollection];
[assetRequest addAssets:@[[createAssetRequest placeholderForCreatedAsset]]];
//PHAssetCollectionChangeRequest *assetCollectionChangeRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:assetCollection];
//[assetCollectionChangeRequest addAssets:@[[createAssetRequest placeholderForCreatedAsset]]];
} completionHandler:^(BOOL success, NSError *error) {
if (!success) {
NSLog(@"Error creating asset: %@", error);
}
}];
} else {
//NSLog(@"Error creating album: %@", error);
NSLog(@"didFinishRecordingToOutputFileAtURL - success for ios9");
}
}];