Closed niravspaceo closed 10 years ago
productIdentifier should be NSString.
Example :
NSString productIdentifier = @"com.comquas.nsmag.issue1";
[[IAPShare sharedHelper].iap provideContent:productIdentifier];
or
NSString productIdentifier = transaction.payment.productIdentifier;
[[IAPShare sharedHelper].iap provideContent:productIdentifier];
Sorry for my example is not clear.
Hello,
Thanks a lot..!!! It worked.....
I am facing another problem and that is how to restore particular in-app purchase.? Can you just give me some lines of code so i can integrate it.
Thanks,
You can restore like following code
[[IAPShare sharedHelper].iap restoreProductsWithCompletion:^(SKPaymentQueue *payment, NSError *error) {
NSLog(@"Transactions %@",payment.transactions);
}];
but how can i come to know whether restore has done successfully or it fails?
and another problem i am facing is , when i purchase product successfully ,after that i stop debugging in device, and again i debug in device and when i check whether that product has purchased or not, at that time it gave me not purchased , though i have purchased it before and it goes to again for purchase.
What can be the problem?
Next time open the app , you can check with isPurchasedProductsIdentifier function.
if([[IAPShare sharedHelper].iap isPurchasedProductsIdentifier:@"com.comquas.iap.test"]
{
// require saving product identifier first
}
if you want to get all purchased product , you can get with
NSLog(@"%@",[IAPShare sharedHelper].iap.purchasedProducts);
For restore success or not , you can check the error is nil or not
[[IAPShare sharedHelper].iap restoreProductsWithCompletion:^(SKPaymentQueue *payment, NSError *error) {
if(error==nil)
{
NSLog(@"restore success");
}
}];
please read the Read Me file for detail.
Thanks a lot man.. It was my problem.. I didn't allocated [IAPShare sharedHelper].iap that's why next time open the app it redirects me to purchase data every time.
Thanks,
:+1:
Hello,
I have used your code to make in-app and i am getting an error here, [[IAPShare sharedHelper].iap provideContent:productIdentifier]; . it is saying me that use of undeclared identifier productIdentifier . how to solve it??
Thanks.