views:

1366

answers:

1

I'm trying to set up In-App purchasing with the Store Kit at the moment. I've got the Store Kit programming guide but there's aspects which aren't clear. I'm trying to first of all, just get a response from iTunes connect with the following:

- (void)requestProductData {
SKProductRequest *request = [[SKProductsRequest alloc] initWithProductIndentifiers: [NSSet setWithObject: @"com.domain.appname.productid"]];
request.delegate - self;
[request start];
}

- (void)productsRequest:(SKProductsRequest *)request didRecieveResponse:(SKProductsResponse *)response {
NSArray *myProduct = response.products;
NSLog(@"array count: %i", [myProduct count]);
}

I have the storekit framework added - I have the Storekit.h added and the delegate in the .h. I have set up a test product in iTunes (in my code I have the full path instead of the sample above). But it always returns 0 for the Array count.

Does anyones have any experience with this? It seems there's very little documentation and no actual sample code.

Thanks!

UPDATE! I believe this is to do with App Ids and provisioning profiles now. It seems you need specific App Ids and Profiles for the App. I'm testing this out and will answer the question if this is right. Anyone else who can confirm it please do!

A: 

First, you'll have to make sure all your paperwork with Apple is finished. That's in the Contract, Tax Info, and Banking section.

Yes, you do need a specific App ID, and the App ID prefix (aka a Bundle Seed ID). You can't use a wildcard App ID here. I'm talking about something like "ABCDE12345.com.mycompany.myapp".

Yes, you do need to have an IAP item marked as Cleared for Sale. (You'll need to set up the App ID prefix first.) Some people report that you need to check the Cleared for Sale checkbox when you create the IAP item; that leaving it unchecked and then trying to edit & enable it later doesn't work.

Yes, you do need a provisioning profile set up, because:

No, you can't test the store kit in the simulator - you need to run on a device, whether that device is an iPhone, iPad, or iPod Touch. You can check this with [SKPaymentQueue canMakePayments], which will also return NO if you're on a device with parental controls that have disabled the store.

No, you don't need to have the application itself for sale in the App Store, but I think you might need to approve it for sale and then reject it in order to get it into the right state.

AndrewS