multithreading - In app purchase on iphone.: How to receive your available products *before* someone may be able to buy it -
Currently I am loading my supported products with a plast and after this I send SKProductsRequest to give this guarantee That my SKProducts are still valid.
So I establish the request, start it and get feedback in:
- (zero) Product Request: (SKP ProductsexQuest *) Requested Response: ( SK Projects Response *) Response
Now, so far all tasks are problematic: Calling the request until the response is received, it can last for several seconds. Unless my app is already loaded and user can be able to choose and buy a product.
But because no products have been found, the available products are not synchronized with valid products -> is not likely, but possible error.
So I think wait till the data is loaded and only continue if the list is valid. (Just wait a few seconds ...). I have a single example of managing all the products.
+ (MyClass *) Shared Instructions {if (! Shared Instance) Shared Instance = [MyClass new]; // Wait until our data is no longer [Status lock]; While (noEntriesYet) // Yes when the start is [wait a bet]; [Unlock status]; Return Share Instance; } - Products Confirmation: What Response Response: {[Condition Lock]; // I have my data noEntriesYet = false; [Condition sign]; [Unlock status]; }
Problem: Everything works fine before the app freeze share insensor is completed, if reception response is completed. There are different threads, the lock is working if the wait is reached during the dideriveiveResponse, everything is fine. But if not, the reception response has never been called, even if the request has been sent. Lock is on, everything looks fine. I have tried to send the product request to a different NSThread, the nuoption queue ... without profit
- Why? What is happening?
- How to fix the problem
I think you During the loading of the products, your GUI will block. In this situation the user may not be able to change anything. For the past: While working with App Store, I use a transparent view + UITTV indicator to block an app.
Comments
Post a Comment