[ERROR] Could not create a bookmark: NSError: Cocoa 4097 "connection to service named com.apple.FileProvider" when using PhotosPicker

Hi I am using PhotosPicker and SwiftData with iOS17.0. I released my own app using codes of two above. No problem came up right until I upgraded my iphone to iOS 18.0 17th of September 24. A single post pokes the similar problem. SwiftData and PhotosPikcer. He or She said it was about SwiftData Model Insert something. But, I was able to use other methods that use SwiftData, so insert Model setup isn't my problem.

But when tapping a photo to get a photo from PhotosPicker makes the ui goes down, and navigate back. Weird. iIt doesnt crash but when I tap a photo, the debug message [ERROR] Could not create a bookmark: NSError: Cocoa 4097 "connection to service named com.apple.FileProvider" comes up and the view navigates back. The selecting a photo itself doesnt include any SwiftData related methods, it only does loadTransferable thing and shows the photo on the screen.

I cannot understand it. it only happened when I upgraded to iOS 18.0. AND Then i debugged the prob with Xcode 16.0 nothing but the unexpected message appears and not many posts are up here or google. Can you help me?

Things I tried:

  1. Check any use of the PhotosPickerItem anywhere else. -> No where.
  2. Use try await loadTransferable
  3. Changed the form of initiating PhotosPikcer View
  4. Debugging every line -> Nothing appeared.
     PhotosPicker(selection: $currentImage, matching: .images, photoLibrary: .shared()) {
            Text("")
        }
        .frame(height: 360)
        .photosPickerStyle(.inline)
        .photosPickerAccessoryVisibility(.hidden, edges: .bottom)
        .photosPickerDisabledCapabilities(.selectionActions)
        .onChange(of: currentImage) { _, newImage in
             // SomeLogic 
        }
        .ignoresSafeArea(edges: .bottom)
        .transition(.move(edge: .bottom).combined(with: .opacity))

Could you please provide a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

I have the same issue. XCode 15.4 (15F31d) on MacOS 14.5 (23F79), project is built for iOS 17.5. This is my test project: https://github.com/philipto/Nserr/tree/master This is the error I see in the console: [ERROR] Could not create a bookmark: NSError: Cocoa 4097 "connection to service named com.apple.FileProvider"

Xcode 16.1 beta 2 / iPadOS 18.1 beta 5

Using the PhotoPicker. It is intermittent. Used the same component in two different views. One succeeded, one failed with the described error.

I have the same problem. I get the two lines in the Logs and then an EXC_BREAKPOINT.

[ERROR] Could not create a bookmark: NSError: Cocoa 4097 "connection to service named com.apple.FileProvider"

updateImageHeadroom:1309: *** ERROR: CGImageSetHeadroom: 8.000000 failed for image with kCGColorSpaceDisplayP3 color space

Breakpoints do not work most of the times with async code. And this is the only thing i get from the Stack trace:

CoreTransferable`(1) await resume partial function for reabstraction thunk helper <τ_0_0, τ_0_1, τ_0_2 where τ_0_0: CoreTransferable.Transferable, τ_0_0: Swift.Decodable, τ_0_0: Swift.Encodable, τ_0_1: Combine.TopLevelEncoder, τ_0_2: Combine.TopLevelDecoder, τ_0_1.Output == Foundation.Data, τ_0_2.Input == Foundation.Data> from @escaping @callee_guaranteed @Sendable @async (@guaranteed Foundation.Data) -> (@out τ_0_0, @error @owned Swift.Error) to @escaping @callee_guaranteed @Sendable @async (@in_guaranteed Foundation.Data) -> (@out τ_0_0, @error @owned Swift.Error):

Xcode16.0, Swift6

Same issue here, very annoying as it floods the logs. No idea what is causing it.

Thanks for every reply.

I just couldn't figure out why so I just left it broken, hoping OS upgrade would fix it. (Lucky that the service doesn't have many users.) AND I couldn't help upgrading my test phone(iPhone13) to iOS 18.1 beta, voila now the PhotoPicker doesn't cause any trouble.

It did delay a month for me to upgrade more features but, I learned a lesson that I really should be handling new iOS every year before (at least) any RC version drops.

I'm getting a crash using PhotosPicker, and it can be reproduced using a sample project provided by Apple: https://developer.apple.com/documentation/photokit/bringing_photos_picker_to_your_swiftui_app

If you load that project and then change "Swift Language Version" to "Swift 6" in the Build Settings, when you come back from the photo picker the app crashes.

FWIW, the other sample project provided by Apple works after updating it to swift 6: https://developer.apple.com/documentation/photokit/implementing_an_inline_photos_picker

I took that project and changed it slowly to integrate into my project and it works.

[ERROR] Could not create a bookmark: NSError: Cocoa 4097 "connection to service named com.apple.FileProvider" when using PhotosPicker
 
 
Q