UIPasteboard in Quick Look Preview Extension blocked by Sandbox?

Though I cannot find any documentation, it seems that UIPasteboard cannot be used from a Quick Look Preview app extension.

I have such an extension, which contains a view that supports copying text as follows:

- (IBAction)copy:(nullable id)sender {
    UIPasteboard * pboard = UIPasteboard.generalPasteboard;

    pboard.string = _rep.text;
}

This is invoked from a context menu (edit menu) item.

This works fine In the simulator, but on device the pasteboard remains empty and errors like the following are emitted:

-[PBServerConnection pasteboardWithName:createIfNeeded:authenticationBlock:dataOwnerBlock:error:] failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.pasteboard.pasted was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.pasteboard.pasted was invalidated: failed at lookup with error 159 - Sandbox restriction.}

It's unclear to me why such functionality would be problematic and necessary to block.

It would be nice if this were documented clearly, as I wasted a lot of time trying to figure out why this was not working.

(And no, I have not filed a feedback report or TSI yet, as I'm presently very short on time, and I don't have a sample project prepared to demonstrate the issue.)

UIPasteboard in Quick Look Preview Extension blocked by Sandbox?
 
 
Q