Skip to main content

Should I use the main app’s bundle identifier, or should I create a new app in revenue cat in the same project with the watchkitapp identifier?

Hi @Arnaud! 👋🏻

 

For Apple watch, the app should work with the main app’s bundle identifier. 

See an example setup here https://stackoverflow.com/a/62778077/5074358 (we’ve issued patches for the path issues on watchOS so no need to worry about that part of the answer in SO). 

 

If you use StoreKit Configuration files, I’m not entirely sure that purchases will be validated if you use the main app’s bundle identifier. I’m in the process of testing that, but having some issues getting either of my 2 watches to run 🤦🏻‍♂️

 

I’ll update when I get it to work

 

 


Thanks, @Andy  and please do keep me posted!

Up until now, I used WatchConnectivity to pass the subscription status, but I would rather not depend on it.


To be clear, using the main app’s bundle ID should work, the part that I’m testing is compatibility with StoreKit Configuration files. But that’s not strictly needed for an app, it just allows for somewhat easier testing. 


To be clear, using the main app’s bundle ID should work, the part that I’m testing is compatibility with StoreKit Configuration files. But that’s not strictly needed for an app, it just allows for somewhat easier testing. 

Very clear. I did the test with StoreKit Configuration files, I’m actually not sure I tested without them.


I’m still running into issues running with StoreKit Configuration files, it looks like I might have to factory reset both my Apple Watches to get something working 🤕

 

In the meantime, if you test with StoreKit Config files and the main app’s bundle ID, as long as you’re not getting “Receipt is not valid” after a successful purchase, you should be good. If you do get that error message, there are two solutions: 

Either:

  • Separate the apps in RevenueCat and have one with each bundle ID
  • Test exclusively in Sandbox, without StoreKit Configuration files.

The good news is that production and sandbox should work correctly regardless with the main app’s bundle ID. 


I’ll update here when I hear back from my support ticket, but just a caution, RC on Apple Watch doesn’t appear to pick up the RCID from the phone and so it can’t read the subscription status. Hopefully this is an issue my end.


I can’t get the companion app on my Apple Watch to get entitlement-status. I also get no debug-info from RevenueCat even when setting Purchases.logLevel = .debug in my Apple Watch App. I do have different bundle id:s as suggested by Apple. com.myname.myapp for my iOS-app and com.myname.myapp.watchkitapp for my Watch companion app. Am I doing something wrong? This is my code in the Apple Watch App to set upp RevenueCat:

import SwiftUI
import RevenueCat

@main
struct MyApp_Watch_AppApp: App {
@StateObject var subscriptionStatus = SubscriptionStatus()

var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(subscriptionStatus)
}
}

init() {
print("Apple watch revenuecat init")
Purchases.logLevel = .debug
Purchases.configure(withAPIKey: "xxxxxxxxxxxx")
}
}
import Foundation
import RevenueCat

@MainActor
class SubscriptionStatus: ObservableObject {
@Published var isActive = false

init() {
print("SubscriptionStatus: init()")
refresh()
}

func refresh() {
Purchases.shared.getCustomerInfo { customerInfo, error in
self.isActive = customerInfo?.entitlementsn"premium"]?.isActive == true
}
}
}

All I see in my console is:

Apple watch revenuecat init
SubscriptionStatus: init()

Nothing else. No RC debug-messages.

I’m running the code on physical iPhone and physical Apple Watch. No storekit configuration files.


Reply