Ios – In App Purchase sandbox problem

app-store-connectin-app-purchaseiosiphonexcode

currently I am developing iOS application, which needs In App Purchase.

As in many tutorials (like this: http://www.raywenderlich.com/2797/introduction-to-in-app-purchases). I've created new app in iTunesConnect, uploaded binary and rejected it. After that i added few in app purchase products. In next step I added Storekit to my Xcode project and after that I wrote this code in my UIViewController:

- (void)buyPressed
{
    SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObjects: @"com.mycompany.appliaction_name.levelpack",nil]];
    request.delegate = self;
    [request start];
    NSLog(@"request started");
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    NSArray *products = response.products;
    for (int i=0; i<[products count]; i++) 
    {
        SKProduct *proUpgradeProduct = [products objectAtIndex:i];
        if (proUpgradeProduct)
        {
            NSLog(@"Valid product id: %@" , proUpgradeProduct.price);
            NSLog(@"Product title: %@" , proUpgradeProduct.localizedTitle);
            NSLog(@"Product description: %@" , proUpgradeProduct.localizedDescription);
            NSLog(@"Product price: %@" , proUpgradeProduct.price);
            NSLog(@"Product id: %@" , proUpgradeProduct.productIdentifier);
        }
    }

    for (NSString *invalidProductId in response.invalidProductIdentifiers)
    {
        NSLog(@"Invalid product id: %@" , invalidProductId);
        UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Apple connection error!" message:nil delegate:self cancelButtonTitle:@"CLOSE" otherButtonTitles:nil];
        [myAlertView show];
        [myAlertView release];
    }
}

And I still receive info that all my in app products have invalid product id. Today I've found this: http://developer.apple.com/library/ios/#technotes/tn2259/_index.html

And one important thing:
"Important: DO NOT upload the development binary to iTunes Connect until the application is ready for App Review approval. If the binary is present in iTunes Connect and it is not fully functional, App Review will review the binary and likely reject the development binary. Testing In App Purchase will fail if you or App Review reject your most recent binary in iTunes Connect. The workaround in this case is to upload a binary without In App Purchase features that can get approved by App Review. Once the binary is approved, resume testing the binary with In App Purchase features."

So I have to create new app in iTunes once again, or should I build and submit my app without in app purchase and when app will appear in iTunes develop new version with in app purchase?

Thanks for answers!

Best Answer

invalidProductIdentifiers (An array of product identifier strings that were not recognized by the Apple App Store. (read-only))

So make sure you are not using the same product identifier which was rejected

Run Xcode after disconnecting your device, and run a Build->Clean All Targets.

Run Xcode->Empty Caches, and then quit and re-launch Xcode.

After Xcode is re-launched and your device has restarted, re-connect it to you machine.

Create an entirely new iTunes Test Account on the iTunesConnect portal.

Build and Run your application from XCode to your device using a Development profile and then attempt to purchase the product using the new iTunes Test Account.

If you submit an application and the binary is rejected for any reason In-App Purchase may cease to function correctly in the sandbox. Apple states that the only way to restore this is to re-submit an app binary without IAP functionality and get it approved first (but not necessarily released).

Look at my another related [ANSWER]

Related Topic