saturngod / IAPHelper

No more maintenance for this repo. Please use the https://github.com/bizz84/SwiftyStoreKit
MIT License
1.56k stars 280 forks source link

How to clear a purchased product from keychain? #5

Closed nnhubbard closed 10 years ago

nnhubbard commented 10 years ago

When in development, we are making sure to test what happens when we purchase a product. But, since that is saved in the keychain as purchased, how can we clear that out, so we can test it again?

macbearchen commented 10 years ago

try following: @"your.iap.id" as your product ID

[SFHFKeychainUtils deleteItemForUsername:@"your.iap.id" andServiceName:@"IAPHelper" error:nil]; // reset previous purchase

saturngod commented 10 years ago

Thank @macbearchen.

@nnhubbard , now , you can use like following

[[IAPShare sharedHelper].iap clearSavedPurchasedProducts];
[[IAPShare sharedHelper].iap clearSavedPurchasedProductByID:@"com.myproduct.id"];