Posts

Post not yet marked as solved
3 Replies
3k Views
WWDC21 session 10123 shows a screen that implies the guardian instance of your app is able to select apps on your child's device to encourage or to control. In my experience with the API so far I can't see a way to do this. The API only seems to work on the child's phone. Here are my questions: Is there a suggested way to determine whether the app is running on a guardian device? The only way I can see is to attempt AuthorizationCenter.shared.requestAuthorization and check for an error value of .invalidAccountType. But it seems you could get that error for other reasons too. Is there a way to present FamilyActivityPicker on the guardian device but have it show apps on the child's phone? I don't see any thing in the API for selecting a child account to access with `FamilyActivityPicker', it seems to only show the phone's user's apps (or no apps if it's the guardian's phone). After retrieving app tokens from 'FamilyActivityPicker' is there a recommended way to present to the user in the UI? The WWDC session shows an app icon and app name (i.e. "Books" and "Solar System"), but my understanding is that info is hidden from the developer for privacy reasons. So I'm wondering if the example in the session is really feasible.
Posted
by pinch.
Last updated
.
Post not yet marked as solved
3 Replies
2.5k Views
Since iOS 13 I can't get original-res versions of photos in My Photo Stream using PhotoKit. I've had several complaints from users over the last few months, so it's not anything specific to my own device or account. The following code always retreives very small images (e.g. 360 x 480).PHPhotoLibrary.requestAuthorization({ status in DispatchQueue.main.async { if status == .authorized { // if iCloud Photo Library is disabled and Photo Stream is enabled this will give you My Photo Stream let photoStream = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumMyPhotoStream, options: nil) if let photoStreamCollection = photoStream.firstObject { let res = PHAsset.fetchAssets(in: photoStreamCollection, options: nil) if let asset = res.firstObject { let opts = PHImageRequestOptions() opts.deliveryMode = .highQualityFormat opts.isSynchronous = true opts.isNetworkAccessAllowed = true opts.resizeMode = .exact print("asset size: \(asset.pixelWidth) x \(asset.pixelHeight)") PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize, contentMode: .default, options: (img, info) in if let img = img { print("image size: \(img.size.width * img.scale) x \(img.size.height * img.scale)") } } PHImageManager.default().requestImageDataAndOrientation(for: asset, options: opts) { (imgData, dateUTI, orientation, info) in if let imgData = imgData { if let img = UIImage(data: imgData) { print("image size: \(img.size.width * img.scale) x \(img.size.height * img.scale)") } } } } } } } })asset size: 1536 x 20482020-02-02 08:18:44.452620-0700 photostreamphoto[7370:2576203] [ImageManager] [RM]: 1-1-0 Failed to decode image2020-02-02 08:18:44.468675-0700 photostreamphoto[7370:2576203] [ImageManager] [RM]: 1-1-0 Failed to decode image2020-02-02 08:18:44.479691-0700 photostreamphoto[7370:2576203] [ImageManager] [RM]: 1-1-0 Failed to decode imageimage size: 360.0 x 480.02020-02-02 08:18:44.485069-0700 photostreamphoto[7370:2576203] [ImageManager] [RM]: 1-2-0 Failed to load image from URL: file:///var/mobile/Media/PhotoStreamsData/267078714/100APPLE/IMG_0001.JPG2020-02-02 08:18:44.490447-0700 photostreamphoto[7370:2576203] [ImageManager] [RM]: 1-2-0 Failed to load image from URL: file:///var/mobile/Media/PhotoStreamsData/267078714/100APPLE/IMG_0001.JPG2020-02-02 08:18:44.501745-0700 photostreamphoto[7370:2576203] [ImageManager] [RM]: 1-2-0 Failed to load image from URL: file:///var/mobile/Media/PhotoStreamsData/267078714/100APPLE/IMG_0001.JPGimage size: 360.0 x 480.0I've tried every conceivable combination of options in PHRequestOptions. Note that if I set opts.version = .original it gives me a nil image and nil image data.I've also tried asset.requestContentEditingInput(...) to try to access the image URL directly and I get this error in the console:2020-02-02 08:26:49.641787-0700 photostreamphoto[7416:2578984] [PhotoKit] Asset resource file URL not reachable, may have been pruned, will attempt availability change requestInterestingly, UIImagePicker does retrieve the original-res image (e.g. 1536 x 2048). The Photos app also shows the full-res image.
Posted
by pinch.
Last updated
.