Easy to edit com.something.plist without jailbreak. Using the free tool * you can view your device, you can also edit and save these files. If you store your inapp purchase like this:
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"com.example.pack1"]; [[NSUserDefaults standardUserDefaults] synchronize];
then this will be written to plist:
<key>com.example.pack1</key> <true/>
If you name your packages as follows: pack1, pack2, etc., and someone edits your plist (copy / paste the first key), he can easily use the lock function.
It is not too difficult to implement the method to save the following:
[[NSUserDefaults standardUserDefaults] setValue:[self sha1ValueForKey:@"com.example.pack1"] forKey:@"com.example.pack1"]; [[NSUserDefaults standardUserDefaults] synchronize];
where -sha1ValueForKey: -
-(NSString *)sha1ValueForKey:(NSString *)key { return [self sha1:[NSString stringWithFormat:@"<SALT>%@", key]]; }
You need to change <SALT> to something.
Here you can find -sha1: :: http://www.makebetterthings.com/iphone/how-to-get-md5-and-sha1-in-objective-c-ios-sdk/
After that, you can check if the key matches the hashed value.
If someone wants to crack your plist, he / she should know your hash mechanism and salt. This is not the safest way to protect your application, but it is easy to implement.
* IEXPLORER
EDIT:
The proposed method only protects - somewhat - your IAP if the user does not have access to the hashed value. If someone gets it from somewhere, it's easy to copy this data into a plist. If SALT is device-dependent copying, it is useless.