Implementing a list of dynamic servers using MKStoreKit?

I use MKStoreKit in my application, but the nature of the application is such that it will need to support frequent dynamic changes in the list of available (non-consumed) products for purchasing the application. Thus, I need to be able to regularly request our server for the current list of available product identifiers, descriptions, etc.

As far as I can tell, MKStoreKit only supports a static plist of available products, which means that we will need to release an application update every time we need to change our list of IAP products. As I mentioned, this is not possible with this service.

Does anyone know how to update our list of IAP products by downloading it from a server without requiring an application update using MKStoreKit.

If not, I have to imagine that there are people who have changed the code to support this. If so, any advice and wisdom would be greatly appreciated.

Thanks in advance.

+5
source share
1 answer

As far as I can see, MKStoreKit retrieves the list of your products as plist in the following method MKStoreManager.m:

#pragma mark Internal MKStoreKit functions
//line 201 of MKStoreManager.m

- (NSDictionary*) storeKitItems
{
  return [NSDictionary dictionaryWithContentsOfFile:
          [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]];
}

So, if you just changed this method call, for example, to get a new element from your server, you can achieve the desired result.

, prepopulated.plist, NUSUserDefaults, NSDictionary, , , .

, :

- (NSDictionary*) storeKitItems
   {
     if(![[NSUserDefaults standardUserDefaults]valueForKey:@"NewConfigs"])
             [[NSUserDefaults standardUserDefaults]setValue:[NSDictionary dictionaryWithDictionary:[NSDictionary dictionaryWithContentsOfFile:
                                                                                                           [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]]] forKey:@"NewConfigs"];
 [[NSUserDefaults standardUserDefaults]synchronize];

 return [[NSUserDefaults standardUserDefaults]valueForKey:@"NewConfigs"];
    }
+4

All Articles