Post marked as solved
398
Views
For PHPickerViewController, we know we can perform simple filtering by
var config = PHPickerConfiguration()
config.filter = PHPickerFilter.images
But, how about we only want to show images with format JPG & PNG, but excluding GIF? This is because our app doesn't support GIF.
Is it possible to do so?
Post marked as solved
63
Views
PHPickerViewController crashes with the error 'Picker's configuration is not a valid configuration.' when I try to use PHPickerViewController with a configuration that has preselectedAssetIdentifiers specified, and I can't figure out why.
The identifier looks like "12345678-1234-1234-123456789012/L0/001", and I'm getting it from PHPickerResult.assetIdentifier. The exact same code works if I specify preselectedAssetIdentifiers as an empty array.
I was worried that it was just undocumented that this feature required full photo library permissions, but after giving .readWrite permissions I still experience the issue.
My iPhone 13 Pro is running 15.4.1.
The only lead on this I've found is https://stackoverflow.com/questions/71765492/pickers-configuration-is-not-a-valid-configuration-swift, but I'm uncomfortable with the solution of recreating my project without identifying a cause that I can avoid in the future.
Post not yet marked as solved
64
Views
Is there a way to update the metadata of a AVAsset/PHAsset to show a different still photo when the asset is not being played? If so what class should I look at to update the AVAsset or PHAsset? I am looking to edit the asset itself, not show a layer over the video. I would prefer to do this without trimming the video.
Post not yet marked as solved
1.9k
Views
What is Error Domain=com.apple.photos.error Code=46104 mean?
This error appears when I try to create an album on iOS14.
case:
User first gives AddOnly authorization and then gives ReadWrite authorization.
After I get the ReadWrite authorization, create an album.
code reference:
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCollectionChangeRequest *request = [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:albumName]
albumPlaceholder = [request placeholderForCreatedAssetCollection];
} completionHandler:^(BOOL success, NSError * _Nullable error) {
// success is NO, error is "Error Domain=com.apple.photos.error Code=46104"
}];
The supplementary log information for the above question is as follows:
2020-08-17 11:28:19.470871+0800 XXXX[4255:1139139] CoreData: XPC: Unable to connect to server with options { NSXPCStoreServerEndpointFactory = "<PLXPCPhotoLibraryStoreEndpointFactory: 0x280ce8760>"; skipModelCheck = 1;}
2020-08-17 11:28:19.479533+0800 XXXX[4255:1139139] CoreData: XPC: Unable to load metadata: Error Domain=NSCocoaErrorDomain Code=134060 "关键数据出错。" UserInfo={Problem=Unable to send to server; failed after 8 attempts.}
2020-08-17 11:28:19.483149+0800 XXXXX[4255:1139139] [error] error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134060)
CoreData: error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134060)
CoreData: annotation: userInfo:CoreData: annotation: Problem : Unable to send to server; failed after 8 attempts.
CoreData: annotation: storeType: NSXPCStoreCoreData: annotation: configuration: (null)
CoreData: annotation: URL: file:///var/mobile/Media/PhotoData/Photos.sqlite
CoreData: annotation: options:
CoreData: annotation: NSXPCStoreServerEndpointFactory : <PLXPCPhotoLibraryStoreEndpointFactory: 0x280ce8760>CoreData: annotation: skipModelCheck : 1
2020-08-17 11:28:19.485049+0800 XXXXX[4255:1139139] [Generic] Failed to connect to XPC PhotoLibraryStore file:///var/mobile/Media/PhotoData/Photos.sqlite with options { NSXPCStoreServerEndpointFactory = "<PLXPCPhotoLibraryStoreEndpointFactory: 0x280ce8760>"; skipModelCheck = 1;}: Error Domain=NSCocoaErrorDomain Code=134060 "关键数据出错。" UserInfo={Problem=Unable to send to server; failed after 8 attempts.}
2020-08-17 11:28:19.485565+0800 XXXXX[4255:1139139] [Migration] Failed to configure PSC for library file:///var/mobile/Media/: Error Domain=NSCocoaErrorDomain Code=134060 "关键数据出错。" UserInfo={Problem=Unable to send to server; failed after 8 attempts.}
2020-08-17 11:28:19.485943+0800 XXXXX[4255:1139139] [LibraryBundle] Unable to create PLLibraryBundleLogInfo because PSC is nil
There is another problem. When saving the video, if the AddOnly permission is taken first and then the ReadWrite permission is taken, the performChanges method will freeze for more than 10 seconds before calling the completionHandler. The following is the log information:
[Generic] Failed to connect to XPC PhotoLibraryStore file:///var/mobile/Media/PhotoData/Photos.sqlite with options {
NSXPCStoreServerEndpointFactory = "<PLXPCPhotoLibraryStoreEndpointFactory: 0x280700d00>";
These problems only occur during a cold launch when the AddOnly permission is taken first and then the ReadWrite permission is taken. Whether the app only takes the AddOnly permission, only takes the ReadWrite permission, or closes the app after authorization and reopens it will not happen.
Post not yet marked as solved
72
Views
The app is a webview where there is a form where an input file image is loaded.
The problem is that when selecting an image from the camera, the app crashes.
If you can upload images from Photo LIbrary and Choose File
Post not yet marked as solved
118
Views
There are list of frames displayed at the bottom of the screen when videos are played on Photos app in iPhone. Which API is used for this functionality in iOS photo app. Is it possible to check this ?
Post not yet marked as solved
82
Views
There's only a single function under PHPickerViewControllerDelegate which is didFinishPicking according to the documentation. How do I implement dismiss for the Cancel button that comes along when tapping out with PHPickerViewController?
Have no problem if continue using UIImagePickerControllerDelegate, as it comes with imagePickerControllerDidCancel . However, if I were to implement with the new PHPickerViewController that currently only have a single function, how to enable proper dismiss right on the click of Cancel button instead of just relying the swipe down to dismiss the screen. Kindly advise. Thanks.
Post marked as solved
182
Views
Started working on a photo editing extension in Xcode. no matter what I do whenever I select my extension to edit a photo the app crashes with the following error.
After finding the solution for hours only thing I got was to uninstall and restart the app, but that too didn’t work.
The following is the screenshot of the error.
Post not yet marked as solved
100
Views
I would like to be able to select a photo in iOS using Swift from the Photos library using
UIImagePicker and copy all the image (with modified Exif metadata) to a
new photo which I save in Photos. If I use UIActivityViewController to
choose the save option (from copy/save/assign to contact/print/add to
shared album/save to file), the input image Exif metadata is not transferred
when I create a new UIimage from the loaded image data with the
modified metadata. How can get the image with modified Exif metadata attached
to the saved photo?
Post not yet marked as solved
103
Views
The same code can generate livePhoto in iOS 14, but can't generate livePhoto in iOS 15.1.
Does anyone know how to solve this problem? please help me. thanks
Post not yet marked as solved
465
Views
Work well in iOS 15.0 but after upgrading to iOS 15.1, the codes can't get worked.
_ = PHLivePhoto.request(withResourceFileURLs: [pairedVideoURL, pairedImageURL], placeholderImage: nil, targetSize: CGSize.zero, contentMode: PHImageContentMode.aspectFit, resultHandler: { (livePhoto: PHLivePhoto?, info: [AnyHashable : Any]) -> Void in
if let isDegraded = info[PHLivePhotoInfoIsDegradedKey] as? Bool, isDegraded {
return
}
DispatchQueue.main.async {
completion(livePhoto, (pairedImageURL, pairedVideoURL))
}
})
Post marked as solved
373
Views
I want to change the background color of PHPicker's navigationbar in iOS15.
↓This answer did not work in PHPicker
https://developer.apple.com/forums/thread/682420
How to customize?
Post not yet marked as solved
116
Views
tl;dr; Is there a way to ensure that only "Never" and "Read and Write" appear under Settings -> App Name -> Photos on devices running iOS 14 or higher?
The Issue:
The enhanced image library access permissions incorporated as part of iOS 14 are creating problems with a custom image selection flow created for an app and I'm just curious if there is a way to eliminate the "Selected Photos" option from the app settings until the app can be fully updated to offer users the enhanced security.
I've removed the "Select Photos..." option from the iOS permission alert viewcontroller for the Images Library by setting the value for the PHPhotoLibraryPreventAutomaticLimitedAccessAlert key to 'true' as recommended in the Apple documentation:
https://developer.apple.com/documentation/photokit/phauthorizationstatus/limited
However, if the device is running iOS 14 or higher, the option for "Selected Photos" is still available when I go to the App's settings in the device's Settings menu. If a user interacts with permissions at this level the app does not function properly. I was wondering if anyone has experienced this as well and possibly come up with an interim solution.
Post not yet marked as solved
122
Views
Am using a Supervised Device with 15.4 OS
Scenario:
I have tried to push the Restriction payload to Device , with value true for "allowOpenFromUnmanagedToManaged" key .
case 1:
When i try to open a photo from Photo Library and try to open in with any Managed App ,the suggestions for managed app is not listed there. (Working as Expected)
My Problem is:
case 2:
But when i open the Managed App and Try to add a photo , It allows me to open the Photo Library ,from where i can add it.
If Sharing data from unmanaged to managed app is restricted, then it shouldn't be added in case2 ,Right?
FYI: The managed App i have used in Outlook App
Can Anyone Help me this strange Behaviour? Thanks In Advance
Post not yet marked as solved
987
Views
I use the following code to parse Photo metadata and this works well. However, I am unable to pull the new iOS 14 "caption" from this metadata (it worked in early iOS 14 betas, but has since stopped working in the GM.) Does anyone know how I can get the caption data from a PHAsset? Thanks!
Stephen
let options = PHContentEditingInputRequestOptions()
options.isNetworkAccessAllowed = true
asset.requestContentEditingInput(with: options, completionHandler: {(contentEditingInput, _) -> Void in
if let url = contentEditingInput?.fullSizeImageURL {
let fullImage = CIImage(contentsOf: url)
// get all the metadata
self.allPhotoMetadata = fullImage?.properties ?? [:]
// {TIFF}
if let tiffDict = self.allPhotoMetadata["{TIFF}"] as? [String:Any] {
if tiffDict["Make"] != nil {
self.cameraData[cameraKeys.make] = tiffDict["Make"]
}
if tiffDict["Model"] != nil {
self.cameraData[cameraKeys.model] = tiffDict["Model"]
}
if tiffDict["ImageDescription"] != nil {
self.imageData[imageKeys.caption] = tiffDict["ImageDescription"]
}
}
// {IPTC}
if let iptcDict = self.allPhotoMetadata["{IPTC}"] as? [String:Any] {
// if we didn't find a caption in the TIFF dict, try to get it from IPTC data
// first try, Caption/Abtract, then ArtworkContentDescription
if self.imageData[imageKeys.caption] == nil {
if iptcDict["Caption/Abstract"] != nil {
self.imageData[imageKeys.caption] = iptcDict["ArtworkContentDescription"]
} else if iptcDict["ArtworkContentDescription"] != nil {
self.imageData[imageKeys.caption] = iptcDict["ArtworkContentDescription"]
}
}
}
}
})
}