Search code examples
iosin-app-purchaseitunes-store

Cannot connect to iTunes Store (to get in-app purchase listing)


I am trying to get the listing from the store of in-app purchase items for my app. Here is what I have done:

  • installed new provisioning profile with In-App Purchases enabled. (Replacing the provisioning profile was tricky but I think I have it correct)
  • verified that tax and banking info is OK. (The app is already for sale in the store).
  • created test user
  • logged in with test user on test device
  • (device is not jail-broken)
  • created in-app purchase items and set Cleared for Sale to Yes. (Items are in Ready to Submit status).
  • waited several hours
  • using the full product IDs with the requests.

The only thing I'm not sure about from the answer to this previous question (Cannot connect to iTunes store error) is the part that says: 3)Does your project’s .plist Bundle ID match your App ID?

The Bundle ID is listed as N-A.${PRODUCT_NAME:rfc1034identifier} so I'm not sure how to expand that out to see that it matches. However, since this app is in the store for sale, I'm not sure how this could be off.

The error from the store is Code 0, "Cannot connect to iTunes Store".

Thanks for any help!


Solution

  • The problem turned out to be none of the items on the checklist, but rather a syntactical blunder resulting from my inexperience with Swift. The same issue is not likely to happen to others but I present the solution below for the sake of completeness:

    func fetchAvailableProducts() {
        // wrong syntax (but able to compile):
        // let productIDs:NSSet = NSSet(objects: ["com.mysite.IAP1MONTH", "com.mysite.IAP6MONTH"])
    
        // correct syntax:
        let productIDs:NSSet = NSSet(objects: "com.mysite.IAP1MONTH", "com.mysite.IAP6MONTH")
        let productsRequest:SKProductsRequest = SKProductsRequest(productIdentifiers: productIDs);
        productsRequest.delegate = self;
        productsRequest.start();
    }