Question

I have been trying to implement a non-renewing subscription for my application to unlock certain features. I have followed Ray Wenderlich's tutorials using Parse (http://www.raywenderlich.com/36270/in-app-purchases-non-renewing-subscription-tutorial) but can't get it to work. Somehow if the user buys a product it gets stored in the phone as well cause when I try to login as another user who haven't bought the product all the features are unlocked. I have tried fixing this but nothing seem to help. If I remove the application the data is gone and I can log in as a user who haven't bought anything not seeing the locked features.

Have someone had the same problem? I'm thinking about using iCloud instead to store user data. I can't though find any tutorial covering how to implement an iCloud account together with a subscription. Can someone help me out here? Where to start? Are there any good tutorials I've missed?

Thanks!

Was it helpful?

Solution

To solve your problem using the sandbox (NSUserDefaults), create a dynamic key for each features to unlock, including the Parse (or other service) username. Since this username is unique (mandatory for Parse), you will be sure to get expected behaviour.

In this code...

[[NSUserDefaults standardUserDefaults] setObject:expiryDate forKey:@"ExpirationDate"];

Replace the forKey value by

[username stringByAppendingString:@"ExpirationDate"]

...where username is a NSString containing the unique username.

OTHER TIPS

Somehow if the user buys a product it gets stored in the phone as well cause when I try to login as another user who haven't bought the product all the features are unlocked. I have tried fixing this but nothing seem to help.

This is due to this line which stores the expiration date locally:

[[NSUserDefaults standardUserDefaults] setObject:expiryDate forKey:@"ExpirationDate"];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top