UIPasteboard.generalPressboard in action extension
I've been working on an Action extension since beta 1. This is a URL shortter via bitly.com. When the url is truncated, it is copied to custom cardboard
UIPasteboard.generalPasteboard().URL = shortUrl
This works great the last time I checked out beta 5. As far as GM is concerned, looks like we no longer have access to cardboard?
po UIPasteboard.generalPasteboard().URL
Returns nil in scripts that I know are there, and when I check that the shortUrl actually contains a value, the assignment is ignored. Print UIPasteboard.generalPasteboard().URL
always returns zero when debugging an extension.
Is the access to the cardboard removed? It seems to be a silent rejection, if so.
I have reproduced this in Objective-C as well, so this is not a Swift issue.
Update
I tried this on an extension with a UI (there are two types of action extensions, without and with). For users with a user interface, cardboard works as expected. So it seems isolated to action extensions without a UI.
I also reported a bug.
Update 2
I believe this is a mistake, Apple has closed my radar as a duplicate.
source to share
I have a problem too. I am using it in objective-C. I tried cardboard in the simplest form and still nothing.
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setString:@"copied string"];
The above code works fine in the containing app.
Update: For anyone still looking for an answer and wanting to use cardboard with a custom keyboard extension, I came across this post: iOS8 Custom Keyboard - Copy and Paste to UIP Archive
You will need to allow full BOTH access in your plist file and allow full access to keyboard settings in Settings.app.
source to share