ImportFromDevicesCommands - The operation couldn’t be completed. (Cocoa error 66563.)

I am trying to use import from iPhone option as shown in WWDC session.

I added code

 WindowGroup {

            ContentView()

                .environment(\.managedObjectContext, persistenceController.container.viewContext)

            

        }

        .commands {

            ImportFromDevicesCommands()

        }

ContentView.swift is

 List {

                ForEach(items) { item in

                    NavigationLink {

                        Text("Item at \(item.timestamp!, formatter: itemFormatter)")

                    } label: {

                        Text(item.timestamp!, formatter: itemFormatter)

                    }

                }

                .onDelete(perform: deleteItems)

            }

            .importsItemProviders([.image,.png,.jpeg,.rawImage], onImport: { providers in

                print("checking reachability")

                return true

            })

The importsItemProviders block itself is not executed and not printing anything.

In addition I am getting alert The operation couldn’t be completed. (Cocoa error 66563.)

Is there anything to add for making this functionality work ?

  • Are there any updates to this? In addition to getting the error above, I am unable to consistently get the options to be available as they are grayed out. I feel like there is a nuance to how these are supposed to work that is not explained or documented. Could really use some thoughts here from the SwiftUI team.

Add a Comment