-
Notifications
You must be signed in to change notification settings - Fork 796
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
Buggy ProductsInfoController #212
Comments
The issue also appears if you change the price. There should be the way to refresh this data. |
The problem lies in the fact that SwiftyStoreKit caches products internally to that product information for any given product is only retrieved once. Based on this report, I believe the best solution is to remove the caching altogether, and leave clients to implement it if desired. This way, each time a new purchase is requested, SwiftyStoreKit will fetch the updated For convenience, in addition to these methods: class func retrieveProductsInfo(_ productIds: Set<String>, ...)
class func purchaseProduct(_ productId: String, ...) a new method could be made available: class func purchaseProduct(_ product: SKProduct, ...) This is so that if the client has already pre-fetched a product with I should have this implemented and working soon. |
@bizz84 wait. What about to store these methods and add something like the following:
Or even a property which enables/disables caching. |
I think removing the cache is more in line with the lightweight spirit of SwiftyStoreKit, so I'm more inclined to remove state rather than adding state. class func purchaseProduct(_ product: SKProduct, ...) Clients can use this new method if they wish to prevent any un-necessary network calls, or they can use the old API and things will still work. |
Add new purchase product method based on SKProduct. (#212)
Resolved in release 0.10.2. |
I liked the caching. It's sad you removed it for this weird use cases. |
Platform
In app purchase type
Environment
Version
0.9.0 (but the same code is not fixed in 0.9.2)
Related issues
Report
Issue summary
1)request purchases
2)minimize app and change app store account to another one with different currency
3)return to app and request purchases again
What did you expect to happen
Products return currency from the second account
What happened instead
Products return currency from the first account. They are cached and the problem is with the whole
ProductsInfoController
:`
guard products.count == productIds.count else {
1)
products.count == productIds.countdoesn't mean that all the products are the same - you should compare them by id 2)even if
products.count == productIds.countthen the currencies could be different as in my case 3)I wrote that the whole class is buggy because only
retrieveProductsInfo(...)` func in this class is public and other code is private so I can't even properly fix this code for my case.So the fastest fix I see is to make everything inside
ProductsInfoController
public. The better fix is to allow force callrequestProducts
which is not called because ofproducts.count == productIds.count
statementThe text was updated successfully, but these errors were encountered: