I am working on an app that provides users with the ability to sign in and out using accounts on my service. I also want to provide users with the ability to purchase auto-renewable subscriptions.
I can't figure out how to enable users to sign in and out using accounts on my service and purchase auto-renewable subscriptions. This is because StoreKit purchases are tied to the device's logged in Apple ID, and cannot be tied to accounts on my system.
For example, suppose:
- A person has an iPhone and is signed in to iOS on that device using their Apple ID:
bob@icloud.com - This person downloads my app, and creates
userAin my account system. - As
userA, they buy an auto-renewable subscription. This purchase is stored on the StoreKit receipt for userbob@icloud.com. - Without changing Apple IDs, the person signs out my app and creates
userBon my system. - The person tries to buy the same auto-renewable subscription for
userB. When they do this nothing happens. Specifically, this code:
SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:[self.products objectForKey:identifier]];
//...
[[SKPaymentQueue defaultQueue] addPayment:payment];
does not prompt userB to purchase, because as far as StoreKit is concerned, they already own it, because they are still bob@icloud.com on the device.
Even if I store subscription information on my servers (which I do), I'm not sure how I can remedy the situation except for allowing only Apple Sign In on the iOS version of my app. This is because Apple Sign In is strictly tied to the current Apple ID on the device.
Is this really the only way to have users in an app that also has IAP auto-renewable subscriptions? I've searched the web and it seems like that's the case.