LaunchServices error when trying to share to apple Books

I am stuck on a problem, I'm trying to share from my app to Apple Books on iOS. When I perform the share action, the ActivityViewController acts like it is preforming the operation and everything appears to go well, however the shared file never appears in Books.

In the xcode console I get a Launch Services error:

2020-02-09 14:48:25.031316+0700 AppName[1040:282769] [default] LaunchServices: open operation <NSBlockOperation: 0x103006010> failed with error: Error Domain=NSOSStatusErrorDomain Code=-54 
"Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]} service was canceled

I've looked around at what could be causing this and from what I can find, it seems most likely that my app does not have the correct permissions to access iBooks, but when I run UIApplication.canOpenURL for the iBooks schemes it comes back as true.

I opened up the simulator console as well where I found a bit more to this error:

Unentitled query <_LSDocumentProxyBindingQuery: 0x10253c750> issued from pid 1021. Disallowing and yielding an error.  
Could not find apps for <private>: Error Domain=NSOSStatusErrorDomain Code=-54
"Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=<private>}.
Invalid LSOpenOperation request: Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed,
_LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}
LaunchServices: [Perform] not launching application - result = Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed"
UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}

But I can't seem to find why the query is unentitled, or how to set it to be allowed.

I have tried adding the ibooks URL scheme to both LSApplicationQueriesSchemes and CFBundleURLTypes but that didn't make a difference.
I also tried saving the file manually and setting the NSFileProtectionKey to none per this post showing the same console error (not completely sure I implemented this correctly however)

I also tried using another app I've created that uses the activityVC to see if that app could share to iBooks and I get the same problem and the same error.

Sharing to all other iOS apps works fine, it is just iBooks that has the problem.

Any point in the right direction would be really appreciated!

I have exactly the same problem. did you find a solution to this ?
I encountered this error and discovered that the reason was that there was a typo in my entitlements file. Also check your info.plist file.
LaunchServices error when trying to share to apple Books
 
 
Q