phphotolibrary

Saving photo with metadata into Camera Roll with specific file name

百般思念 提交于 2019-12-05 10:55:13
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((__bridge CFDataRef) imageData, NULL); if (!isOriginal) { [meta resetOrientation]; } NSString *timestamp =

How to get images from Custom album of Photos, iOS SDK?

给你一囗甜甜゛ 提交于 2019-12-04 22:31:40
问题 I'm working on an iOS app in which I need gallery view like Instagram. I have added gallery View, camera View and video View, after taking image it saves to custom album of Photos. Now I want to retrieve those images from custom album and show it to Collection view of Gallery. But I'm getting stuck in retrieving those images from custom album. Any help will be appreciated. Edit: I added the PHPhotoLibrary for creating custom photo album, before this I added AssetsLibrary framework. An Then I

Accessing the camera and photo library in swift 4

僤鯓⒐⒋嵵緔 提交于 2019-12-04 14:20:16
问题 I'm trying to access both the camera and photo library in swift4 using the following code let imagePickerController = UIImagePickerController() imagePickerController.delegate = self let alert = UIAlertController(title: "", message: "", preferredStyle: .actionSheet) alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: {(action: UIAlertAction) in imagePickerController.sourceType = .camera print(1) })) alert.addAction(UIAlertAction(title: "Photo Album", style: .default,

Editing Photo metadata and PHAdjustmentData

拥有回忆 提交于 2019-12-04 04:07:55
问题 The following function loads a photo, edits the exif metadata attached to it and saves it back out. The function only seems to work for photos that already have a PHAdjustmentData attached ie photos that have been edited with another application previously. If a photo hasn't been edited it fails in the performChanges() block and prints Failed to save. Error: Optional(Error Domain=NSCocoaErrorDomain Code=-1 "(null)"). Why does it fail in this situation? Looking through Stack Overflow I have

How to get images from Custom album of Photos, iOS SDK?

怎甘沉沦 提交于 2019-12-03 14:55:38
I'm working on an iOS app in which I need gallery view like Instagram. I have added gallery View, camera View and video View, after taking image it saves to custom album of Photos. Now I want to retrieve those images from custom album and show it to Collection view of Gallery. But I'm getting stuck in retrieving those images from custom album. Any help will be appreciated. Edit: I added the PHPhotoLibrary for creating custom photo album, before this I added AssetsLibrary framework. An Then I created a NSObject class (CustomAlbum) for creating and managing the custom photo album using

Detect add photos only permission

喜夏-厌秋 提交于 2019-12-03 13:00:23
问题 In ios 11 we now have "Add photos only" permission setting. But how we now determinate which photo library access level is set? [PHPhotoLibrary authorizationStatus] works only for "Read and Write" permission check. If app asked only for "Add photos only" permission then it stays PHAuthorizationStatusNotDetermined . If user changed it from "Read and Write" to "Add photos only" it gives PHAuthorizationStatusDenied . So, how can I tell if my app have permissions to do "Export to Camera Roll"

Detect add photos only permission

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 04:04:00
In ios 11 we now have "Add photos only" permission setting. But how we now determinate which photo library access level is set? [PHPhotoLibrary authorizationStatus] works only for "Read and Write" permission check. If app asked only for "Add photos only" permission then it stays PHAuthorizationStatusNotDetermined . If user changed it from "Read and Write" to "Add photos only" it gives PHAuthorizationStatusDenied . So, how can I tell if my app have permissions to do "Export to Camera Roll" feature, which dosen't require read permissions? since iOS 11, in order to gain only Write access you'll

PHPhotoLibrary requestAuthorization, not requesting

血红的双手。 提交于 2019-12-01 23:20:33
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: [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { switch (status) { case

Error Domain=NSCocoaErrorDomain Code=-1 “(null)” when moving .mov to camera roll

眉间皱痕 提交于 2019-12-01 15:43:46
I'm having a weird problem moving a .mov file created by my app from the documents folder to the camera roll. A bit of background: The app makes time lapse movies. It works specifically with the devices that have a 12 megapixel 4032x3024 sensor. It created the movies in the app's documents folder. The movies can be saved as either 4k or HD. They can also be saved as a 4:3 aspect ratio movie of the entire sensor, or a 16:9 crop of the sensor. If the user wants the movie to be stored in the Camera Roll of the device, they can set that option. My problem exists when trying to move a full size

Error Domain=NSCocoaErrorDomain Code=-1 “(null)” when moving .mov to camera roll

强颜欢笑 提交于 2019-12-01 14:28:18
问题 I'm having a weird problem moving a .mov file created by my app from the documents folder to the camera roll. A bit of background: The app makes time lapse movies. It works specifically with the devices that have a 12 megapixel 4032x3024 sensor. It created the movies in the app's documents folder. The movies can be saved as either 4k or HD. They can also be saved as a 4:3 aspect ratio movie of the entire sensor, or a 16:9 crop of the sensor. If the user wants the movie to be stored in the