KasemJaffer / receive_sharing_intent

A Flutter plugin that enables flutter apps to receive sharing photos, text and url from other apps.
Apache License 2.0
334 stars 391 forks source link

iOS sharing doesn't share to app #209

Open Aimtracker opened 2 years ago

Aimtracker commented 2 years ago

I have followed the setup process on a fresh flutter app without including the share text and URLs because my app only needs to share images (and optionally videos). I have not included the <key>com.apple.developer.associated-domains</key> entitlement since the documentation states it's only required for URL sharing and I am currently on a free account.
When I deploy the app on my Device (iPhone 12 Pro iOS 15.3.1) I can select the app when I share an image, but it appears that something only "opens" in the background, closes and throws me back to the gallery again.

The console output from my device throws the following error:

*** -[NSXPCDecoder validateAllowedClass:forKey:]: NSSecureCoding allowed classes list contains [NSObject class], which bypasses security by allowing any Objective-C class to be implicitly decoded. Consider reducing the scope of allowed classes during decoding by listing only the classes you expect to decode, or a more specific base class than NSObject. This will become an error in the future. Allowed class list: {(
    "'NSObject' (0x1dad7de08) [/usr/lib]"
)}
NSXPCInterface: <NSXPCInterface: 0x28034f880>
Protocol: EXExtensionContextHosting
SEL: _openURL:completion: (2 arguments, 0 proxies)
 Classes: [NSURL, {}]
 Reply block: (arg #3, (1 arguments, 0 proxies), signature 'v@?B') [{}]
SEL: _loadPreviewImageForPayload:contextIdentifier:completionHandler: (3 arguments, 0 proxies)
 Classes: [{NSURL, NSItemProvider, NSError, NSDictionary, NSString, NSExtensionItem, NSArray, NSData, NSNumber, _EXItemProviderExtensionVendorLoadOperator, NSDate, CKShare, _EXItemProviderSandboxedResource, NSValue, NSNull, NSUUID, _EXItemProviderCopyingLoadOperator, UIImage}, NSUUID, {}]
 Reply block: (arg #4, (2 arguments, 0 proxies), signature 'v@?@@"NSError"') [{NSObject}, {NSError}]
SEL: _cancelRequestWithError:forExtensionContextWithUUID:completion: (3 arguments, 0 proxies)
 Classes: [{NSError}, NSUUID, {}]
 Reply block: (arg #4, (0 arguments, 0 proxies), signature 'v@?') []
SEL: _completeRequestReturningItems:forExtensionContextWithUUID:completion: (3 arguments, 0 proxies)
 Classes: [{NSURL, NSItemProvider, NSError, NSDictionary, NSString, NSExtensionItem, NSArray, NSData, NSNumber, _EXItemProviderExtensionVendorLoadOperator, NSDate, CKShare, _EXItemProviderSandboxedResource, NSValue, NSNull, NSUUID, _EXItemProviderCopyingLoadOperator, UIImage}, NSUUID, {}]
 Reply block: (arg #4, (0 arguments, 0 proxies), signature 'v@?') []
SEL: _loadItemForPayload:contextIdentifier:completionHandler: (3 arguments, 0 proxies)
 Classes: [{NSURL, NSItemProvider, NSError, NSDictionary, NSString, NSExtensionItem, NSArray, NSData, NSNumber, _EXItemProviderExtensionVendorLoadOperator, NSDate, CKShare, _EXItemProviderSandboxedResource, NSValue, NSNull, NSUUID, _EXItemProviderCopyingLoadOperator, UIImage}, NSUUID, {}]
 Reply block<…>

After researching this error I found that it is (or was) a bug on Apple's side.
Source 1: https://stackoverflow.com/questions/70118893/nsextension-runtime-warning-nsxpcdecoder-validateallowedclassforkey
Source 2: https://developer.apple.com/forums/thread/689603

Did anybody else experience this behaviour?
Is the entitlement still needed, even if I only want to share images?

jr-ger commented 2 years ago

I am experiencing exactly the same behavior. I also did not include URL sharing entitlements.

Have you found any solution by now?