我在我的应用程序中实现了MKStoreKit,但该应用程序的性质决定了它需要支持在应用程序购买中对可用(非消耗性)产品列表进行频繁、动态的更改。因此,我需要能够定期向我们的服务器查询可用产品ID、描述等的当前列表。
据我所知,MKStoreKit只支持可用产品的静态plist,这意味着每次需要更改我们的IAP产品列表时,我们都必须发布应用程序更新。正如我已经提到的,这在这个服务中是不可能的。
有没有人知道有一种方法可以更新我们的IAP产品列表,方法是使用MKStoreKit从服务器上下载它,而不需要更新应用程序。
如果没有,我不得不想象有人已经修改了代码来支持这一点。如果是这样的话,任何获得的提示和智慧都将不胜感激。
提前谢谢。
发布于 2012-04-11 05:09:54
据我所知,在MKStoreManager.m的以下方法中,MKStoreKit以plist的形式检索您的产品列表
#pragma mark Internal MKStoreKit functions
//line 201 of MKStoreManager.m
- (NSDictionary*) storeKitItems
{
return [NSDictionary dictionaryWithContentsOfFile:
[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]];
}因此,如果您只需更改此方法调用,例如,从您的服务器获取新项目,您就可以获得所需的结果。
例如,您可以预先填充一些.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"];
}https://stackoverflow.com/questions/9233718
复制相似问题