Question

Error with Facebook SDK Integration in RevenueCat

  • 7 January 2024
  • 1 reply
  • 30 views

Hey,


I am currently integrating the Facebook SDK with RevenueCat in my project and have followed the instructions as per documentation. I recently updated to the latest version of the Facebook SDK using the package manager. However, I encountered an issue while setting up the Facebook anonymous ID.

Here is the snippet of the code I'm using:

Purchases.shared.attribution.collectDeviceIdentifiers()
Purchases.shared.attribution.setFBAnonymousID(FBSDKCoreKit.AppEvents.anonymousID)


The compiler throws the following error:
"Instance member 'anonymousID' cannot be used on type 'AppEvents'; did you mean to use a value of this type instead?"

I'm wondering if there have been any changes in the SDK or RevenueCat's integration process that I might have missed. Could you please provide some guidance on how to resolve this error or suggest an alternative way to correctly implement this functionality?

Regards


1 reply

Userlevel 5
Badge +9

Hi @pilsen83,

Facebook updated their SDK and changed how the methods work slightly.

Try this:

Purchases.shared.attribution.collectDeviceIdentifiers()
Purchases.shared.attribution.setFBAnonymousID(FBSDKCoreKit.AppEvents.shared.anonymousID)

 

Reply