Converting paid app to freemium with IAP

Hello,

I have an existing app which is beeing sold in the app store since 2010. Now I want to convert this app into a free app with optional in-app purchases. A part of the functionality which paid users currently have should then be accessible only by IAP.

Therefore, I must identify my existing customers, to not make them pay again for functionality they have paid already.

Googling around reveals that this is not easy to do, if it was possible at all. However, I found this post: https://stackoverflow.com/questions/3735635/convert-existing-ios-paid-app-to-freemium-model-with-in-app-purchase
Quote:

"There is now an Apple-approved way to do this on both iOS and macOS. The
originally downloaded version of the app can be obtained from the
receipt using the info key Original Purchased Version. You can then decide whether to unlock features if that version predates the switch to IAP."

Now I have played around with this a bit, or more precisely:

Code Block
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];

However, in my tests, receipt will always be nil. The URL also points to some local location with sandbox in the name.

Am I doing something wrong in general, or is this just not supposed to work how I thought it would? Note that I have installed my app from the app store on my device, then launched the above code on my device (so I'm NOT testing this in the simulator).

I also read about SKReceiptRefreshRequest, however I cant figure out how to use it.

So the question is, how would I figure out if a user has already purchased the orignal paid version? My app does not have a server-component, and by checking some NSUserDefaults key would result in charging users which reinstall the app on a new device.

So what should I do?
Hello? :)

The URL also points to some local location with sandbox in the name.

You test on device, not simulator ?
Could you show the url ?

You test on device, not simulator ?
Could you show the url ?

I am testing it on my iPhone 11 Pro connected to the MacBook via cable, and compiling/running the app directly on device via XCode.

This is what the URL looks like:

Code Block
(lldb) p receiptURL
(NSURL *) $0 = 0x0000000280179f80 @"file:///private/var/mobile/Containers/Data/Application/577AA8C8-8D2F-4CEF-958E-32BD27CEB8BF/StoreKit/sandboxReceipt"
(lldb) p receipt
(NSData *) $1 = nil


To me this looks like that the app - since it was installed on the device by XCode - was not installed by the app store, and thus it cannot get any receipt information. That in turn would raise the question how I would be able to test my implementation when I cannot debug it?

Hi s710, I would check out this video for some help. It's what I'm using to move forward on this problem:

https://developer.apple.com/wwdc22/10007

Converting paid app to freemium with IAP
 
 
Q