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

那年仲夏 提交于 2019-12-24 05:36:05

问题


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!


回答1:


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();
}



回答2:


Swift 1.2 introduced a Set class, so do this now:

let pids: Set<NSObject> = ["com.mysite.thing", "com.mysite.otherThing"]
let productsRequest = SKProductsRequest(productIdentifiers: pids)


来源:https://stackoverflow.com/questions/26470565/cannot-connect-to-itunes-store-to-get-in-app-purchase-listing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!