Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pasteboard prompt/message appearing after photo share from ShareButton #2524

Open
5 tasks done
AdamEssenmacher opened this issue Jan 12, 2025 · 0 comments
Open
5 tasks done

Comments

@AdamEssenmacher
Copy link

AdamEssenmacher commented Jan 12, 2025

Checklist before submitting a bug report

Xcode version

15.4

Facebook iOS SDK version

17.0.2

Dependency Manager

CocoaPods

SDK Framework

Share

Goals

I would like to share a photo from my app to Facebook using a ShareButton.

Expected results

When the share is complete and my app is reactivated, the user should not be pestered with a prompt to allow/disallow pasting from Facebook.

Actual results

The user is pestered with a prompt to allow/disallow pasting from Facebook.

Steps to reproduce

  1. Add a ShareButton.
  2. Set the ShareButton's ShareContent to a SharePhotoContent with Photos[] containing one SharePhoto.
  3. Tap on the 'Share' button to launch the share dialog (FB app installed on device)
  4. Cancel or complete the photo share
  5. User gets prompt: "MyApp" would like to paste from "Facebook"--"Do you want to allow this?"

Code samples & details

This is similar in the unwanted behavior reported in #1467 and #1603, which were deemed to be caused by the app accessing the pasteboard and not caused by FBSDK. I have high confidence that this is not the case here. I thoroughly analyzed my app (and its dependencies) for any unintentional pasteboard access. I found the FBSDK to be the only dependency accessing the pasteboard.

Investigating the FBSDK code, I found this:

https://github.com/facebook/facebook-ios-sdk/blob/adf47300b3de4519674956cbe9d70b689432067f/FBSDKCoreKit/FBSDKCoreKit/Internal/BridgeAPI/ProtocolVersions/_BridgeAPIProtocolNativeV1.swift#L269-287

My Swift isn't very good, but it looks to me like this function accesses the pasteboard on app activation. This can cause the prompt/alert on iOS 16+, right?

WORKAROUND: I tried pre-emptively clearing the pasteboard for pasteboard type "com.facebook.Facebook.FBAppBridgeType" on app activation (based on

) and found that the paste prompt no longer appears. This seems like strong evidence that the FBSDK is causing the unneeded paste alerts.

Sample workaround code (forgive me for the Xamarin):

public override void OnActivated(UIApplication uiApplication)
{
    UIPasteboard.General.SetData(new NSData(), "com.facebook.Facebook.FBAppBridgeType");
    base.OnActivated(uiApplication);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant