假设用户选择10个或更多图像并选择将它们保存到照片库中,则仅保存7-8个图像.
有什么办法可以在没有任何故障的情况下保存照片库中的图像数组吗?
谢谢
let images = Generic.fetchImagesFromMediafiles(self.selectedMediaObj) // to fetch selected imageslet activityVIEwController = UIActivityVIEwController(activityItems: images,applicationActivitIEs: nil)self.present(activityVIEwController,animated: true,completion: nil);if let popoverPresentationController = activityVIEwController.popoverPresentationController { popoverPresentationController.sourceVIEw = self.shareAllVIEw}解决方法 iOS系统写照片保存到相册使用单线程,逐个做.
如果你想同时保存更多的照片,它可能会丢失一些数据.
-(voID)saveBtn{[SSGOTools againRequestPhotoWithblock:^(BOol isAgree) {if (isAgree) {self.listofImages = [NSMutableArray new];int photoNum ;photoNum = (int)_photoArray.count;if (_photoArray.count > 9) {photoNum = 9;}for (int i = 0; i < photoNum; i++) {NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:_photoArray[i]]];UIImage *myImage = [UIImage imageWithData:data];//[self.listofImages addobject:myImage];[self loadImageFinished:myImage];}}}];}- (voID)loadImageFinished:(UIImage *)image{[[PHPhotolibrary sharedPhotolibrary] performChanges:^{//write photo save to album[PHAssetChangeRequest creationRequestForAssetFromImage:image];} completionHandler:^(BOol success,NSError * _Nullable error) {NSLog(@"success = %d,error = %@",success,error);if(success){dispatch_async(dispatch_get_main_queue(),^{[SSGOTools showInfoPopHint:@"Success"];});}}];}总结
以上是内存溢出为你收集整理的ios – 使用UIActivityViewController无法在照片库中保存多张图像全部内容,希望文章能够帮你解决ios – 使用UIActivityViewController无法在照片库中保存多张图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)