0

I am doing one application. In that I am using auto renewal subscription. When I install my application, I will do the subscribe operation. And whenever I reinstall the same application in same device, I have to use the restore operation. So how to find application is install or reinstall.

rptwsthi
  • 10,094
  • 10
  • 68
  • 109
user3146380
  • 61
  • 1
  • 5

2 Answers2

2

you can store the flag value in keychain according to app is installed or not.

use this link for storing value in keychain

http://dev-metal.blogspot.in/2010/08/howto-use-keychain-in-iphone-sdk-to.html

Also for checking application on device that is install or not use this:

Detecting programmatically whether an app is installed on iPhone

use this code for saving value

- (void) savePassword: (NSString*) password {
[self.keychainItemWrapper setObject:password forKey:
       (id)kSecValueData];

}

for retrieve value:

- (void) retrievePassword {
return (NSString*) [self.keychainItemWrapper objectForKey:
       (id)kSecValueData];

}

Community
  • 1
  • 1
Shubham
  • 570
  • 3
  • 12
  • Is this keychain storage is safe?And can i store my information with any key? – user3146380 Feb 25 '14 at 07:17
  • When you need to store data securely from within your iPhone application, sooner or later you will step over the iPhone keychain. This is the super-duper built-in iPhone safe, kindly provided to you by the fruit company. yes you can store value by any key – Shubham Feb 25 '14 at 07:18
  • If any other application,store the data with same key.Then what i can get when i try to retrieve. – user3146380 Feb 25 '14 at 07:19
  • It will overwrite with new value it's your unique key value you need to take other key value pair for other application – Shubham Feb 25 '14 at 07:22
  • So Can i store my data with custom key? – user3146380 Feb 25 '14 at 07:31
  • But in that link they given only some of the keys to set the objects.Can you please send me any link for proof for using any key – user3146380 Feb 25 '14 at 10:57
  • you can create and use your own key I have used same things in multiple my apps. – Shubham Feb 25 '14 at 11:22
  • Should the return type of the `retrievePassword` be `(NSString *)`? Otherwise I think your `return` doesn't have any effect. – Islam Jul 28 '15 at 18:29
1

If any application will write to keychain it's flags to make programmer's life easier, it will become a trash. Keychain main mission - is to store secure data.

As for subscribtions - use methods, provided by framework to find out whether app has something to restore.For example MKStore Kit

More useful links:

link to discussion

link to apple's docs

Community
  • 1
  • 1
alex
  • 2,121
  • 1
  • 18
  • 24