I'd like to find out if there is a way to detect if the user has changed since the last time my app has run on iOS. I understand that exposing the apple ID would violate privacy, but is there any user-specific ID or other information I can leverage to achieve this? Even just being able to see when the current apple ID logged in would be enough.
I am developing an iOS app that is free to download but has one non-consumable product representing a full version unlock, meaning once they purchase, all features of the app are unlocked. Once a user has purchased this product, I store a flag in the app's data indicating this and I don't initialize purchasing after this flag is set. This allows users to use the unlocked content while offline and it also means my app doesn't require them to enter their password every time they use it.
What I notice is that if I log in with user A and purchase the unlock, then log out and log in with user B, the content remains unlocked. If I could detect user change, I could relock the content and restore purchases to see if the new user has indeed purchased the content.
To handle this case without user change detection, either I need to restore purchases every time the app starts (which makes using my app annoying for some users), or leave the app vulnerable to this kind of piracy. Someone could purchase an unlock, then log in/restore purchases/log out on all their friends' phones and transfer the unlocked content to them.
I understand it seems a bit far-fetched, but if the right person (someone with a blog perhaps) discovered a vulnerability like this, then it could be a real issue. People like to steal things on the internet and go to great lengths to hack and pirate. If it isn't difficult to handle, I'd like to handle it in my app, however unlikely. With the scale of the online marketplace, seems like we'd want to shore up any vulnerabilities we can find before they are problematic.