Search code examples
iphoneobjective-cin-app-purchasemkstorekit

MKStoreKit Buy Feature does nothing


I'm trying to get the MKStoreKit working with my Cocos2D game. It look pretty simple to do and I've followed all the steps a couple of times (to check I've done it correctly) but I still can't get it to work. I can retrieve a product name, price and description etc. but I can use the shared MKStoreKitManager to make a purchase.

Here's my code for buying a product:

if([MKStoreManager isFeaturePurchased: @"com.testing.iap.removeAds"]) {      
        NSLog(@"No ads");
    }else{
        NSLog(@"Ads");

        NSLog(@"Buying feature...");

        [[MKStoreManager sharedManager] buyFeature: @"com.testing.iap.removeAds"
                                        onComplete:^(NSString* purchasedFeature)
         {
             NSLog(@"Purchased: %@", purchasedFeature);
             // provide your product to the user here.
             // if it's a subscription, allow user to use now.
             // remembering this purchase is taken care of by MKStoreKit.
         }
                                       onCancelled:^
         {
             NSLog(@"Something went wrong");
             // User cancels the transaction, you can log this using any analytics software like Flurry.
         }];  

    }

Basically if the product hasn't been previously purchased, kick off the purchase process. The problem is nothing happens! I don't even get the onCancelled being called and there are no error messages apart from the one's I can ignore (i.e. iCloud support and custom server options).

Can anyone shed some light on what it is thats stopping me?

Note: I'm testing on an iPhone 4 device running iOS 5.1


Solution

  • I have no idea what wasn't working but after spending al most a full working day trying to get this to work I decided to start a new project from scratch and try again. I done everything exactly the same and it all worked!