MKStoreKit 101: getting a basic delegate example
I wanted to get some 101 help with using MKStoreKit, for Objective-C. In particular I am trying to get the delegate to work and respond, so that I 开发者_开发百科can get things like list of product objects and descriptions. I have tried assigning delegate in my class but can't get it to respond to some of the optional delegate methods.
If someone has a sample implementation it would be great.
This works for me (just using the AppDelegate for now):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
[MKStoreManager sharedManager];
[MKStoreManager setDelegate:self];
[[MKStoreManager sharedManager] purchasableObjects];
return YES;
}
Which calls back (in my AppDelegate):
- (void)productFetchComplete {
NSArray *products = [MKStoreManager sharedManager].purchasableObjects;
NSLog(@"productFetchComplete: %@", products);
}
Perhaps you can show us what you are doing if this isn't working for you.
精彩评论