-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore a purchased product, get SwiftyStoreKit.InternalErrorCode.PurchasedWhenRestoringPurchase #26
Comments
In fact I even comment out the related code and treat this case as restore succeed. But I'm not sure this way is safe or not. And it has multi IAPs, but can't return them at a time. Seems each of the IAP calls the handler of restore, which is also not what I want. private func processRestoreResults(results: [InAppProductPurchaseRequest.TransactionResult]) -> RestoreResults {
var restoredProductIds: [String] = []
var restoreFailedProducts: [(ErrorType, String?)] = []
for result in results {
switch result {
case .Purchased(let productId):
restoredProductIds.append(productId)
// restoreFailedProducts.append((storeInternalError(code: InternalErrorCode.PurchasedWhenRestoringPurchase.rawValue, description: "Cannot purchase product \(productId) from restore purchases path"), productId))
case .Failed(let error):
restoreFailedProducts.append((error, nil))
case .Restored(let productId):
restoredProductIds.append(productId)
}
}
return RestoreResults(restoredProductIds: restoredProductIds, restoreFailedProducts: restoreFailedProducts)
} |
I'm afraid this issue was not fixed. My code didn't change, just replace the SwiftyStoreKit by This time when restore an account which ever purchased, when the handler is called, both restoredProductIds and restoreFailedProducts are empty. And the handler only be called once.
|
Sorry I'm not sure I fully understand your answer. This is what is expected: If the product was never purchased and you call
If the product was previously purchased, you should get:
The new API will always return with a single callback, and an empty array in |
Seems there's some misunderstanding. In my sense, I should get code from In another side, I did read the latest code in master. Seems it changes a lot. To be honest, I'm not confident to use these codes in my app. So I plan to submit with the original version which I test with it for longer time. And then replace with latest one in next update of the app. |
@atjason I have merged all my changes. Please do any further testing after pulling the latest code in master or use pod version 0.2.7. Also I have added a Changelog section in the README - hopefully this clarifies all the recent changes that I have made. |
@bizz84 Sorry didn't reply in time. In these days I was really busy to submit my app to Mac App Store and some other things. Now the app review is passed, but I plan to manually release it on May 3rd. I will merge the latest SwiftStoreKit and adjust my code in these days. But I'm afraid I can't really make sure it works before I really test with the app which is already in Mac App Store. Will update in time. |
@bizz84 This issue itself could be closed as it's fixed. I test with v0.2.7 and found other issues, which I just create new issues. Please check. To be honest, I feel lucky I didn't use this version for the app to submitted to Mac App Store, but use previous version. But still feel upset for the potential issue. Hope we can really make SwiftStoreKit better. In another side, if you can reach the guys who also use SwiftStoreKit, maybe you can tell them the issue of the version before v0.2.7, and invite them to test with latest version of SwiftStoreKit, as you or me couldn't cover all the cases. And my app even hasn't release on Mac App Store, it means I also can't make sure there's issue or not in that production environment. |
In fact already purchased the products. Remove the local information and try to restore, but get this error:
SwiftyStoreKit.InternalErrorCode.PurchasedWhenRestoringPurchase
.The text was updated successfully, but these errors were encountered: