Solved

SwiftUI syncPurchases


Badge +4

Hi all, I could not find much information regarding syncPurchases in SwiftUI.

I am releasing a big upgrade to my app and have changed my RC SDK from V3 to V4 to take advantage of StoreKit2

To make the transition smooth I wish to sync my users purchases and am doing so via my AppNameApp.swift file .onAppear method.

is calling Purchases.shared.syncPurchases {} on the first launch of my upgraded version sufficient for this?

 

Thanks so much

icon

Best answer by cody 20 May 2022, 20:58

View original

2 replies

Userlevel 4
Badge +8

Hey @Nic Deane!

Can you clarify the need for syncing users purchases? The upgrade should be seamless from v3 to v4, and users will retain their existing app user IDs and associated purchases.

That being said, syncPurchases takes the user’s transactions from their device and associates them to the current app user ID. You should be safe to call this once on app launch if you need to re-sync the user’s transactions.

Badge +4

Hi @cody thanks for the response :)

Oh got you that’s really great to know! I was hoping to sync the users current purchases on initial app launch so that the user doesn’t have to manually go and Restore Purchases on a new device :)

Reply