dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSString *gifURL = @"https://static.dongtu.com/netpic/2019072614023570OLJTTM5VQTTVO3.gif";
NSData *gifData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:gifURL]];
NSDictionary *metadata = @{@"UTI":(__bridge NSString *)kUTTypeGIF};
[_assetsLibrary writeImageDataToSavedPhotosAlbum:gifData metadata:metadata completionBlock:^(NSURL *assetURL, NSError *error) {
if (error == nil) {
NSLog(@"SaveSuccess");
}else{
NSLog(@"SaveFailed");
}
}];
});
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSString *gifURL = @"https://static.dongtu.com/netpic/2019072614023570OLJTTM5VQTTVO3.gif";
NSData *gifData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:gifURL]];
[[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{
[[PHAssetCreationRequest creationRequestForAsset] addResourceWithType:PHAssetResourceTypePhoto data:gifData options:nil];
} error: nil];
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者