Question

I have developed a game which is free but offers In app purchases. This worked perfectly fine whilst in testing but since the game has been released (first initial release) attempting to purchase any IAPs results in a crash. I used the Ray Wenderlich IAP tutorial as a base for this code.

When running on a simulator the - didFailWithError handler is hit when trying to get the product list, the error has an error code of 2. I cant even get to the point of testing the IAP with the simulator.

When running the actual production app (from the store) on my phone the crash log states the following:

0   CoreFoundation      0x2e9cfe8b 0x2e8fb000 + 872075
1   libobjc.A.dylib     0x38ccd6c7 objc_exception_throw + 38
2   CoreFoundation      0x2e9cfdcd 0x2e8fb000 + 871885
3   StoreKit            0x310e69d9 0x310e4000 + 10713
4   60 Seconds          0x000b77df -[IAPHelper buyProduct:] (IAPHelper.m:53)
5   60 Seconds          0x000b7091 -[UpgradeViewController Buy5000Squares] (UpgradeViewController.m:199)
6   UIKit               0x3118a55f 0x3114a000 + 263519

So I know it receives the product list correctly, and when double checking against ITC the names are correct (in fact I know they are because I always populate my internal product codes with what the store sends me)

So the real question is what is going on? Why is it crashing and why does my simulator not even let me try to test this?

Some helpful bits of code

-(void)Buy5000Squares
{
    if (![SKPaymentQueue canMakePayments])
    {
        // show alert box
        return;
    }
    [[SecondsIAPHelper sharedInstance] buyProduct:squares5000Product];
}

- (void)buyProduct:(SKProduct *)product {

    NSLog(@"Buying %@...", product.productIdentifier);

    SKPayment * payment = [SKPayment paymentWithProduct:product];
    [[SKPaymentQueue defaultQueue] addPayment:payment];
}

Edit

Turns out that according to this question / answer XCode 5 prevents testing of in app purchases in the simulator (I developed this on the GM of XCode 5 so surprised this is the case) but it offers an explanation at least for that part. Still unsure why it wouldnt work on my device though

Was it helpful?

Solution

It turns out the issue was because I hadnt signed my IAP contracts / banking / tax information properly in iTunes connect. I had previously only created paid apps so hadn't set up this information.

Once I had signed these correctly it started to work after 12-24 hours

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top