Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am getting error while requesting products from App Store for IAP

In IOS6, I was successfully making in-app purchases in my app.

I downloaded IOS/ and Xcode 5 Beta and tried to open the same project.

My code to get products from app store is:

- (void)requestProductsWithIdentifiers:(NSSet*)identifiers
{
        @synchronized(self)
    {
            DebugLog(@"requesting products with identifiers: %@", identifiers);

            self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:identifiers] ;
            self.productsRequest.delegate = self;
            [self.productsRequest start];
    }
}

But it returns an error:

[IAPHelper request:didFailWithError:](114): request did fail with error: <SKProductsRequest: 0xb846a10> / Error Domain=SSErrorDomain Code=2 "Cannot connect to iTunes Store" UserInfo=0xb846b10 {NSLocalizedDescription=Cannot connect to iTunes Store}

Where can be the problem?

like image 372
Burak Avatar asked Aug 15 '13 15:08

Burak


People also ask

Why can't I purchase in app purchases Apple?

Make sure that you're signed in with the same Apple ID that you used to make the purchase. Make sure that in-app purchases are allowed on your device. Restart your device: Restart your iPhone.

Why can't I purchase in app purchases?

Restart the device Tap Power off or Restart (depending on your device this text may be different). If needed, hold down the power button again to turn the device back on. Wait for the device to start back up. Re-open the app or game and check if the in-app purchase has been delivered.

Why does my in app purchase keep failing?

Expired credit cards or old billing addresses are a common reason for payments not to work properly. - Try a different payment method. If you're trying to make an in-app purchase but the transaction is declined or the payment won't go through, try to change your payment method.


3 Answers

Apple blocked testing in-app purchases...

Here is the link to the release notes https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW578

See: iOS Simulator section

StoreKit (In-App purchases) will not work in the Simulator. 13962338

Very sad...

like image 165
Arkady Avatar answered Oct 27 '22 01:10

Arkady


I encountered the same problem recently after installing xcode 5 and the iOS 7 simulator.

Previously SKProductRequests worked in the simulator, but now they fail with error code 2. (They still work on devices).

I'm not sure what is causing this, but my solution was to download the iOS 6.1 simulator. xcode Preferences->Downloads->Components and select the iOS 6.1 simulator.

After that I had to select the iOS 6.1 simulator as my device target, delete the app from the simulator, then compile and run it again. Now the SKProductRequests returned the product info as expected.

I tried switching back to the iOS 7 simulator but SKProductRequests started failing again.

like image 37
adrian Avatar answered Oct 27 '22 02:10

adrian


Update: Testing in-app purchases in the simulator appears to work in the Xcode 6 beta

like image 6
benzguo Avatar answered Oct 27 '22 01:10

benzguo