facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.73k stars 3.5k forks source link

Facebook SDK automatic app events logging with StoreKit2 #2377

Open max-sab opened 1 month ago

max-sab commented 1 month ago

Checklist before submitting a bug report

Xcode version

15.1

Facebook iOS SDK version

16.3.1

Dependency Manager

SPM

SDK Framework

Core

Goals

We are currently making a switch from Original StoreKit to StoreKit2 in our iOS app. We have Facebook SDK of version 16.3.1 (but tried on 17.0.0 as well) that automatically logs our purchase events.

After the migration, we noticed drop in Purchase events quantity in our Events Manager.

While debugging Facebook App Events automatic logging I have noticed that purchase events that Facebook sends from mobile client to Events Manager do not work as expected when purchase is made using StoreKit2:

I've researched Facebook SDK implementation and noticed that it uses public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) to listen for the payment updates (sorry if i missed something and it's not the only method that you use) In my case, purchase made using StoreKit2 does not trigger any events in this function right after the purchase and my theory is that it leads to the drop in our Purchase events quantity.

So my question is if this is a known issue or StoreKit2 purchases should track in the same way as Original StoreKit and it looks like something's wrong with my code?

Thanks in advance!

Expected results

After user makes a purchase either with Original StoreKit or StoreKit2, Facebook SDK sends Purchase event to Events Manager

Actual results

If i make purchase using Original StoreKit SDK -> Facebook SDK logs Purchase event immediately and everything works as expected

if I make purchase using StoreKit2 API -> no event is being tracked. sometimes it's tracked on the next app session, but usually not

Steps to reproduce

Code samples & details

No response

MatoMA commented 1 month ago

We also encountered this issue. We also discovered that Firebase does not support StoreKit 2. Considering that StoreKit 2 does not have any particular advantages, we plan to fall back to StoreKit 1.

max-sab commented 1 month ago

Sad to hear that you've also encountered this issue

We've taken a decision to switch to StoreKit2 and Server-to-Server Notifications v2 to make it easier to handle in-app purchases and therefore it's very important for us that SDKs also support this version of StoreKit

As for now, it'd be amazing to understand whether it's widespread issue and if Facebook Mobile SDK team considers to support that