phphotolibrary

PHPickerViewController load videos via PHAsset

僤鯓⒐⒋嵵緔 提交于 2020-12-15 05:49:16
问题 PHPickerViewController allows access to copies of photo library assets as well as returning PHAssets in the results. To get PHAssets instead of file copies, I do: let photolibrary = PHPhotoLibrary.shared() var configuration = PHPickerConfiguration(photoLibrary: photolibrary) configuration.filter = .videos configuration.selectionLimit = 0 let picker = PHPickerViewController(configuration: configuration) picker.delegate = self self.present(picker, animated: true, completion: nil) And then, /

PHPhotoLibrary save a gif data

☆樱花仙子☆ 提交于 2019-12-30 07:19:30
问题 I can't find a similar method to ALAssetsLibrary->writeImageDataToSavedPhotosAlbum in the new PHPhotoLibrary since ALAssetsLibrary deprecated in iOS 9 I can't save GIF probably I'm using this code [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ PHAssetChangeRequest *assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:[UIImage imageWithData:gifdata]]; placeholder = [assetRequest placeholderForCreatedAsset]; photosAsset = [PHAsset fetchAssetsInAssetCollection:collection

Saving photo with metadata into Camera Roll with specific file name

怎甘沉沦 提交于 2019-12-22 06:41:12
问题 I'm trying to save an image with exif metadata using following code: +(void)saveImageWithMetaToCameraRoll:(UIImage*)image location:(CLLocation*)location album:(PHAssetCollection *)album exif:(NSDictionary *)metadata isOriginal:(BOOL)isOriginal isFavorite:(BOOL)isFavorite completionBlock:(PHAssetBoolBlock)completionBlock { NSMutableDictionary *meta = [metadata mutableCopy]; NSData *imageData = UIImageJPEGRepresentation(image, 1.0f); CGImageSourceRef source = CGImageSourceCreateWithData((_

PHPhotoLibrary requestAuthorization, not requesting

雨燕双飞 提交于 2019-12-20 02:57:09
问题 For testing, I was trying to recreate the system 'Requesting Access' popup experience. Update: Under iOS 11, after deleting the App, the system popup will be displayed again. (previous question) First time the App run (and the only time), the system popup showed, requesting access. After that, not even deleting the App and restarting the device will trigger that popup again. In other words, the device 'remembers' the user request and there's no way to reset it. Here's the code:

Disable confirmation on delete request in PHPhotoLibrary

旧城冷巷雨未停 提交于 2019-12-18 21:51:27
问题 What I am trying to do is to save videos to PHPhotoLibrary, and then remove them when upload to clients remote server in the application completes (basically, photo library serves as temporary storage to add additional layer of security in case anything at all fails (I already save my vides it in the applications directory). Problem: The problem is for that to work, everything has to work without input from the user. You can write video to photos library like this: func

Save the exif metadata using the new PHPhotoLibrary

泪湿孤枕 提交于 2019-12-18 06:55:03
问题 I am currently using AVCaptureStillImageOutput to get a full resolution picture. I am also able to get the exif metadata using the following code: [self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error) { CFDictionaryRef metaDict = CMCopyDictionaryOfAttachments(NULL, imageSampleBuffer, kCMAttachmentMode_ShouldPropagate); CFMutableDictionaryRef mutableDict = CFDictionaryCreateMutableCopy(NULL

Determine if the access to photo library is set or not - PHPhotoLibrary

北城以北 提交于 2019-12-17 04:43:09
问题 With the new functionality in iOS 8, if you are using a camera in the app, it will ask for permission to access the camera and then when you try to retake the pic, it asks for permission to access photo library. Next time when I launch the app, I wish to check if the camera and photo library has access permissions to it. For camera, I check it by if ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusDenied) { // do something } I am looking for

Select multiple image from photo library using swift

妖精的绣舞 提交于 2019-12-13 08:04:42
问题 I am new in IOS and i want to select multiple image from photo library using swift4 and get into array of images.Please help me to do this. 回答1: You can not use the multiple image in UIImagepickercontroller u have to use assetlibrary for it. You can use a custom image picker. I think ImagePicker is best for Swift 来源: https://stackoverflow.com/questions/49993560/select-multiple-image-from-photo-library-using-swift

Metadata lost when saving photo using PHPhotoLibrary

别等时光非礼了梦想. 提交于 2019-12-12 14:57:53
问题 I used to save a photo to the camera roll using ALAssetLibrary's writeImageToSavedPhotosAlbum:metadata:completionBlock, but that is now deprecated in iOS 9.0, so I switched to PHPhotoLibrary's version which looks like [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ [PHAssetChangeRequest creationRequestForAssetFromImage:image]; }completionHandler:^(BOOL success, NSError *error) { if (success){ NSLog(@"Image Saved!"); } else { NSLog(@"Error: %@", error); } }]; This saves the image itself

How to save GIFs with the PHPhotoLibrary?

吃可爱长大的小学妹 提交于 2019-12-10 15:57:03
问题 I have an app that displays GIFs from the internet and I am trying to add the ability to save a GIF to the camera roll. I am using the PHPhotoLibrary and I was trying to save it to the camera roll using the method I've seen in several SO questions such as this one: func saveToCameraRoll(imageUrl: String) { PHPhotoLibrary.shared().performChanges({ _ in let createRequest = PHAssetChangeRequest.creationRequestForAssetFromImage( atFileURL: URL(string: imageUrl)!) }) { success, error in guard