Post

Replies

Boosts

Views

Activity

Unable to capture Live Photo with camera using UIImagePickerController
I have been unable to capture Live Photos using UIImagePickerController. I can capture still photos and even video (which is not my scenario but I checked just to make sure), but the camera does not capture live photos. The documentation suggests it should (source): To obtain the motion and sound content of a live photo for display (using the PHLivePhotoView class), include the kUTTypeImage and kUTTypeLivePhoto identifiers in the allowed media types when configuring an image picker controller. When the user picks or captures a Live Photo, the editingInfo dictionary contains the livePhoto key, with a PHLivePhoto representation of the photo as the corresponding value. I've set up my controller: let camera = UIImagePickerController() camera.sourceType = .camera camera.mediaTypes = [UTType.image.identifier, UTType.livePhoto.identifier] camera.delegate = context.coordinator In the delegate I check for the Live Photo: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { if let live = info[.livePhoto] as? PHLivePhoto { // handle live photo } else if let takenImage = info[.originalImage] as? UIImage, let metadata = info[.mediaMetadata] as? [AnyHashable:Any] { // handle still photo } } But I never get the Live Photo. I've tried adding NSMicrophoneUsageDescription to the info.plist thinking it needs permissions for the microphone, but that did not help. Of course, I've added the NSCameraUsageDescription to give camera permissions. Has anyone successfully captured Live Photos using UIImagePickerController?
1
1
1.6k
Mar ’22
UICloudSharingController no longer allows "add people"
I am building a CloudKit app that uses UICloudSharingController to create and manage the shared content. iOS 15 seems to have removed the "Add People" option from the dialog when using the controller to view an existing share. I've tested on iOS 14.5, and the "App People" option is there and works fine. The same code on iOS 15 shows the UICloudSharingController but the "Add People" option is not there. I'm showing the controller using this code:                     let controller = UICloudSharingController(share: share, container: self.container)                     controller.delegate = self                     self.present(controller, animated: true) The CKShare is properly created and saved. The dialog shows the users that were added during the initial creation of the share. I reported this (FB9495523) during the original iOS 15 betas, but have heard nothing. I've tested on iOS 15 beta 1 and beta 2, both with the same issue. Has anyone else seen this? And if so, any suggestions on how to work around it? My users are not happy. (I realize that I probably can create my own sharing UI to work around this, but I don't want to have to do that!).
9
1
1.4k
Sep ’21
NSPersistentCloudKitContainer: how to un-share objects?
I’m working on an app that uses the new sharing support in NSPersistentCloudKitContainer. I do not see a way to tell Core Data that an object, or set of objects, is no longer shared. For example, if I create a set of objects and then call share(_:to:completion:), the objects are shared properly and moved to a new, custom CKRecordZone, as expected. Now, if the user stops sharing an object using UICloudSharingController, the CKShare that Core Data created is properly deleted from CloudKit, but the objects are still in the custom zone, and Core Data still has the original CKShare associated with those objects. So, when I call fetchShares(matching:), I still get the CKShare, but of course, that is no longer valid. Forcing Core Data to fetch CloudKit changes by either moving the app to background and then foreground, or by stopping the app and relaunching does not cause Core Data to notice the change to the share. Does anyone know how to tell Core Data that these objects are no longer shared? Note, I’ve tried to do further testing, but iOS 15 beta 4 seems to have broken CloudKit, giving “Account temporarily unavailable due to bad or missing auth token” errors. See this post. Sigh, I’m stuck for now.
3
0
1.4k
Jul ’21
NSPersistentCloudKitContainer: How to re-fetch a record from CloudKit?
Is there a way to ask NSPersistentCloudKitContainer to update a local managed object’s values by refetching them from CloudKit? Here is my scenario: Let’s say I have a simple Address Book app that stores first name, last name, and phone number. I use NSPersisentCloudKitContainer to sync the data across a user’s devices. Let’s say a user installs the app on their iPhone and iPad. They add a bunch of records. All is working well. Now, I create version 2 of the app that adds a Notes field. The user installs version 2 on their iPhone, but have not updated their iPad yet. The user then adds some notes to existing records. Obviously, the user’s iPad will not download these notes since they have not updated to the version of the app that supports that field. Now, when the user finally installs version 2 of the app on their iPad, I want to ask NSPersistentCloudKitContainer to fetch the notes fields for the records that have been updated. However, I don’t see a way to do this. Of course, I could get the record ID for the records and download the data from CloudKit myself, then merge it into the local Core Data store. But then I have to manage all the things NSPersistenCloudKitContainer manages for me (errors, completion, etc.). Does anyone have a solution for this?
1
0
845
Jun ’21