开发者

MKStoreKit 101: getting a basic delegate example

开发者 https://www.devze.com 2023-03-12 22:27 出处:网络
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 ob

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消