UIPasteboard.general no longer accessible from INExtension?

Hello everyone!

I have this code in my INExtension:
Code Block
UIPasteboard.general.items.removeAll()

Up through iOS 14.5, this worked correctly. However, in 14.5.1 and 14.6 beta 2, the following error message appears in the console, and the system pasteboard remains unchanged.

Could not save pasteboard named com.apple.UIKit.pboard.general. Error: Error Domain=PBErrorDomain Code=11 "The pasteboard name com.apple.UIKit.pboard.general is not valid." UserInfo={NSLocalizedDescription=The pasteboard name com.apple.UIKit.pboard.general is not valid.}

I filed FB9098625. Is anyone else having this issue?
Just a guess, for what it's worth.

Maybe there are some import that changed and you may have to explicitly add some import declaration (can't tell which) ?
I have the same problem and I am still looking for a solution!
Definitely not as seamless UX wise, but I found a workaround.

Right now I am using the .continueInApp response code in my extension
Code Block swift
completion(MyIntentResponse(code: .continueInApp, userActivity: nil))

and then handling the automatically generated NSUserActivity in the SceneDelegate with
Code Block swift
func scene(_ scene: UIScene, continue userActivity: NSUserActivity)

when the app is already running and checking connectionOptions.userActivities in willConnectToScene for when the app is just launched.


I will be filing a technical support incident and see what happens.

Just a guess, for what it's worth.
Maybe there are some import that changed and you may have to explicitly add some import declaration (can't tell which)?

Thanks for replying Claude. After looking into it, this seems to be an internal UIKit change as I can use the UIPasteboard API normally, it just won't connect to the system clipboard.


I am also facing the same issue. Can't copy value to clipboard from a Siri Extension.

Code Block
Could not save pasteboard named com.apple.UIKit.pboard.general.
Error: Error Domain=PBErrorDomain Code=11
"The pasteboard name com.apple.UIKit.pboard.general is not valid."
UserInfo = {
NSLocalizedDescription=The pasteboard name com.apple.UIKit.pboard.general is not valid.
}

I have the same problem and I am still looking for a solution!

Still occurs in the first iOS 15 beta.

I would appreciate it if everyone affected by this issue could file a feedback 🙂

No changes in the second iOS 15 beta.

Same issue here when using UIPasteboard.general.string while the app is in background.

I have identified today that the issue only exists when using an Extension without UI. As soon as a storyboard is loaded, the generalPasteboard is accessible as soon as viewWillAppear finished.

UIPasteboard.general no longer accessible from INExtension?
 
 
Q