Posts

Post not yet marked as solved
1 Replies
625 Views
In the case where an app uses the Photo Library to reload images by using a fetchRequest with localIdentifier there is hole in the following guidance in WWDC21 "Improve access to Photos in your app" "When the picker session is completed, selected photos will be returned to your app. Suppose the configuration is initialized with a PHPhotoLibrary object, picker results will contain both item providers and asset identifiers. Your app can use the item provider to load and display selected photos." The picker result providers do not load the image if the image is not in the limited library list, even though the user has selected them with the PHPicker. It looks like the workaround is to raise a user error that the image is not loaded because it is not in the limited selection, then do the PHPhotoLibrary.shared().presentLimitedLibraryPicker so the limited selection is the way the user wants it. This workaround seems like an awful thing to do to the user since they have to pick the same photo(s) twice.. Also - this scenario works fine with the PHPickerDemo because privacy setting for the demo is not added in settings.. Presumably because PHPickerDemo is not directly using the PhotoKit API methods. Any thoughts or workaround alternatives that you see? Or raise a bug? Thanks!!
Posted Last updated
.
Post not yet marked as solved
1 Replies
624 Views
Sometimes the log has this cryptic message. Any ideas on what action is needed, or how to implement the 'should have cancelled validation' that is referenced in the message? "[Assert] Somehow we ended up in _validateCurrentFocusedItemForAppearingEnvironment even though there is no focused item. We should have cancelled the validation request in that case."
Posted Last updated
.
Post not yet marked as solved
0 Replies
486 Views
The sample code in the Apple documentation found in  PHCloudIdentifier does not compile in xCode 13.2.1. Can the interface for identifier conversion be clarified so that the answer values are more accessible/readable. The values are 'hidden' inside a Result enum It was difficult (for me) to rewrite the sample code because I made the mistake of interpreting the Result type as a tuple. Result type is really an enum. Using the Result type as the return from library.cloudIdentifierMappings(forLocalIdentifiers: ) and .localIdentifierMappings( for: ) puts the actual mapped identifiers inside the the enum where they need additional access via a .stringValue message or an evaluation of an element of the result enum. For others finding the same compile issue, here is a working version of the sample code. This compiles in xCode 13.2.1. func localId2CloudId(localIdentifiers: [String]) -> [String] {         var mappedIdentifiers = [String]()        let library = PHPhotoLibrary.shared()         let iCloudIDs = library.cloudIdentifierMappings(forLocalIdentifiers: localIdentifiers)         for aCloudID in iCloudIDs {           let cloudResult: Result = aCloudID.value             // Result is an enum .. not a tuple             switch cloudResult {                 case .success(let success):                     let newValue = success.stringValue                     mappedIdentifiers.append(newValue)                 case .failure(let failure):                     // do error notify to user                       }         }         return mappedIdentifiers     } ``` swift func func cloudId2LocalId(assetCloudIdentifiers: [PHCloudIdentifier]) -> [String] {             // patterned error handling per documentation         var localIDs = [String]()         let localIdentifiers: [PHCloudIdentifier: Result<String, Error>]  = PHPhotoLibrary.shared() .localIdentifierMappings(                   for: assetCloudIdentifiers)         for cloudIdentifier in assetCloudIdentifiers {             guard let identifierMapping = localIdentifiers[cloudIdentifier] else {                 print("Failed to find a mapping for \(cloudIdentifier).")                 continue             }             switch identifierMapping {                 case .success(let success):                     localIDs.append(success)                 case .failure(let failure) :                     let thisError = failure as? PHPhotosError                     switch thisError?.code {                         case .identifierNotFound:                             // Skip the missing or deleted assets.                             print("Failed to find the local identifier for \(cloudIdentifier). \(String(describing: thisError?.localizedDescription)))")                         case .multipleIdentifiersFound:                             // Prompt the user to resolve the cloud identifier that matched multiple assets.                             print("Found multiple local identifiers for \(cloudIdentifier). \(String(describing: thisError?.localizedDescription))") //                            if let selectedLocalIdentifier = promptUserForPotentialReplacement(with: thisError.userInfo[PHLocalIdentifiersErrorKey]) { //                                localIDs.append(selectedLocalIdentifier)                         default:                             print("Encountered an unexpected error looking up the local identifier for \(cloudIdentifier). \(String(describing: thisError?.localizedDescription))")                     }               }             }         return localIDs     }
Posted Last updated
.
Post not yet marked as solved
1 Replies
870 Views
My new iMac is rebooting about half way into the installing phase of xCode 13. Many attempts.. always the same crash A Feedback Assistant bug report has been filled. I can restore the last version of xCode from backup Any ideas for a work around? Obviously no new app releases from me until xCode is running again at the 13 version
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
iOS 13 introduced CIFilter "CIKMeans" which is used by the related CIPaletteCentroid  and CIPalettize filters. Are there any examples of the use of CIKMeans? I am mystified by the CIKMeans error "Mean seeds should be passed as a K x 1 image.." I am using a CIImage as the input for the inputMeans parm. The inputMeans attribute has this in the parmDictionary   ▿ 3 elements  ▿ 0 : 2 elements   - key : "CIAttributeDescription"   - value : Specifies the color seeds to use for k-means clustering, either passed as an image or an array of colors.  ▿ 1 : 2 elements   - key : "CIAttributeClass"   - value : CIImage  ▿ 2 : 2 elements   - key : "CIAttributeDisplayName"   - value : Means" What is a CIImage that qualifies as a "K x 1" image?
Posted Last updated
.
Post not yet marked as solved
1 Replies
883 Views
When a user picks asset(s) from the PickerView there should be an interface to return the user to the same album and asset. i.e. the PickerView should show the photoLibrary the way the user left it. This would remove the 'friction' of navigating to the same album when the user is making a change in their selection. In large or deep photoLibraries it is easy to lose track of the spot where a picture was found. In particular the PHPickerResult should return to the app the assetCollection localIdentifier, along with the asset localIdentifier. support an interface for passing the assetCollection and asset localIdentifier(s) to navigate to the same photo library location on the initial open. I would love to use PHPickerViewController as it could replace a significant amount of picking views and code in a photo filter app. But it needs a way to restore the visual state instead of searching again on every image pick. Thanks !! p.s. Is there a better way to submit enhancement requests (such as a bug report)?
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.3k Views
When an instance var of an object changes value then the new state is not shown by the UITableView with a UITableViewDiffableDataSource after the call to dataSource.apply(snapshot).Is there a way for an update/change flag to work on objects in a UITableViewDiffableDataSource?This is mentioned in the https://forums.developer.apple.com/thread/120320 where developers found that changes in fields do not show as the uniqueIdentifiers have not changed in the object.I have found that the object with a instance var change must be deleted from the items in the datasource.snapshot and added with a new unique identifier. Here's some psuedo code to illustrate the behaviourvar snapshot = dataSource.snapshot() updateItem = dataSource.itemIdentifier(for: changedRow) updateItem.stateVar = true dataSource.apply(snapShot)The new state is not shown in the UIInstead to make the new state show I have to remove the old item, copy to a new instance with a new unique identifier, update the state. Then remove the old item from the snapshot and insert the new item.Clearly creating a complete new snapshot instead of copy/change of the existing snapshot would show the new object state. However when only one row of a large dataSource is changed there is a performance problem.Psuedo code that makes the new state showvar snapshot = dataSource.snapshot() updateItem = dataSource.itemIdentifier(for: changedRowPath) updateItem.stateVar = true // make a copy of the updateItem with a new uniqueIdentifier newbieItem = updateItem.clone() // now get the postion prior item in the snapshot priorRow = max(changedRowPath.row - 1, 0) priorItemIndex = IndexPath(row: priorRow, section: changeRowPath.section) priorItem = dataSource.itemIdentifier(for: priorItemIndex) // delete updateItem snapshot.deleteItems([updateItem] snapshot.insertItems([newbieItem], afterItem: priorItem) // now apply with new clone and the changed value dataSource.apply(snapShotDid I miss a simple way to change one row of a dataSource? Or how should this be handled?
Posted Last updated
.
Post not yet marked as solved
4 Replies
1.1k Views
I understand that when the user picks a set of images in the PKPicker mode on the Library object then the usual attributes such as local identifier are returned in the query. If an app stores the local identifiers, can the app load the images in another session with just the local identifier? i.e. is the user permission persistent for later requests via a query on the Photo Libary?
Posted Last updated
.
Post not yet marked as solved
2 Replies
537 Views
Why would user created albums be cut off from app access ? ”User albums however can not be fetched” If the user created the album then they “should “ be able to pick or use the album within a photo editing app, right? The user has decided to organize their images according to their own criteria.. The user created their own system of image selection in an album. It is mystifying to me that user can not access their own album from an app. My first impression is that this decision should be reviewed! My app is built around loading the user created album ( as selected by the user”) so this is a profound effect.
Posted Last updated
.
Post not yet marked as solved
0 Replies
590 Views
Oh my.. back to work to get ready for this line from the Modern Cell Configurations “ Content configurations supersede the built-in sub-views of cells, headers, and footers like the image view, text label, and detailed text label. These legacy content properties will be deprecated in a future release.” No shortage of work for developers !
Posted Last updated
.