Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Prime31 StoreKit: error: Cannot connect to iTunes Store

Discussion in 'iOS and tvOS' started by GTLRussell, Sep 1, 2011.

  1. GTLRussell

    GTLRussell

    Joined:
    Sep 1, 2011
    Posts:
    2
    Hi guys, I've been wrestling with StoreKit for a couple days now. Hopefully you guys can direct me in the right place.

    I don't know if the problem is iTunes Connect related to my app, or a setup problem through Unity and the plugins. I tried to get this all to work through my own UI but had to revert to your StoreKit TestScene to see that it wasn't working there, either.

    <my app name> and <my company name> down below are my valid values for my App)

    2011-09-01 12:26:27.953 <my app name>[453:707] StoreKit: invalid productIdentifier: 10
    2011-09-01 12:26:31.195 <my app name>[453:707] StoreKit: in the process of purchasing
    2011-09-01 12:26:32.033 <my app name>[453:707] StoreKit: error: Cannot connect to iTunes Store

    What I've verified:
    - I have internet access on my device. I can see and view the regular iTunes store from the main screen
    - in the info.plist file in Xcode, the Bundle identifier is com.<my company name>.${PRODUCT_NAME:identifier} and the Bundle name is ${PRODUCT_NAME}.
    - I have a valid Team Provisioning File associated with my device.
    - As instructed in other forums/tutorials, I wiped the device clean and rebuilt everything from scratch, including this provisioning file.

    When clicking on the Restore Completed Transactions button, I am able to successfully log in to the Sandbox with my test account.

    I really don't have anything to go off of. I can only assume that I need an App-specific Provisioning file, or some configuration was not set up properly. We are also using the Social Networking plugin by Prime 31 as well.

    Thanks for any direction you can give me.
     
  2. jpaller

    jpaller

    Joined:
    Aug 17, 2011
    Posts:
    2
    I am actually having virtually the same problem, although it isn't complaining about my productIdentifier being invalid. And I have an app specific provisioning profile and its enabled on the device.
     
  3. jpaller

    jpaller

    Joined:
    Aug 17, 2011
    Posts:
    2
    deleting the app from the device and reinstalling once my app identifier matched the version in the app store fixed my problems. good luck!
     
  4. GTLRussell

    GTLRussell

    Joined:
    Sep 1, 2011
    Posts:
    2
    Ok, I got this to work and it wasn't tricky at all.

    First, my company has a build that was submitted previously to the app store.

    I cleared the app off of the device before opening Xcode.

    in Bundle Identifier, instead of com.<company name>.<product name>, just use <product name>

    I changed Bundle Version from 1.0 to 1.1.

    There were about 20 other web pages on the internet that didn't explain this process at all. Hopefully this will exist in the future for people that get stuck someplace or another.
     
  5. AdsySingle

    AdsySingle

    Joined:
    Jan 5, 2011
    Posts:
    116
    Nothing I do can get rid of this Cannot connect to itunes store. I have tried deleting the app between every build, deleting the provisioning profile, signing out of the store, setting the version number to the same one as currently live on the app store (and I've tried using a higher one), and set up new test user accounts. It worked once, I selected buy to test that and now it fails to connect every time no matter what. I never get to put in account details, it doesn't get that far. I definately am connected to the net, OpenFeint is connected. Does anyone have any more ideas what this might be? I have all the other settings (debug build and provisioning profile) the same as they were when it worked the first time.
    I am calling the RequestProduct function and it is returning 1 item (as it should) so it's getting some data, but the purchase fails with the cannot connect error.
     
  6. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    yeah I am also having trouble recently. I setup StoreKit for this current project, no problems saw the buy button everything worked.

    I am getting invalid product id and can't connect to iTunes store.

    my product ID is com.mehware.shootersalleyios.product for example. I request the product ID and then call purchase product on an OnGUI button. I am confused if i do this...

    StoreKitBinding.requestProductData("com.mehware.shootersalley.product");
    StoreKitBinding.purchaseProduct("com.mehware.shootersalley.product", 1 );

    OR

    StoreKitBinding.requestProductData("product");
    StoreKitBinding.purchaseProduct("product", 1 );

    My bundle id is com.mehware.shootersalley for the application.

    I know I have the IAP setup correctly in iTunes connect. Logged out of the app store, followed all the guidelines etc.

    Any ideas what's going on?

    - Matthew
     
  7. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Correct in that case is
    Did you check if the requestproductData returns anything?
    Did you try to build another product with a simplified ID?
    Are you sure the provisioning profile has In-App enabled?

    I always use "{10 digits dev ID}.ProductName"...
    Tried a fresh test build to see if maybe were something wrong within Apple and it all worked here;
    I don't know what may be causing your issue.
     
  8. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    for some reason I was reading some stuff on stack overflow, resetting my network settings on the device fixed it. I guess it was a device issue.
     
  9. cobaltmind

    cobaltmind

    Joined:
    Dec 21, 2011
    Posts:
    1
    I was just able to complete my first IAP using Prime31's StoreKit plugin (woohoo!) and I thought I'd share the steps I took to get it working. This is NOT meant to be an exact HOW-TO but more of a general path to help out anyone who is currently fighting with this. Also note, the iPhone I'm referring to is an iPhone 3GS running iOS 5.

    1. I read Apple's IAP documentation (mostly) to figure out what the hell is going on with this. Seems really complicated as a noob.
    2. I went through the Provisioning Profile maze and got my iPhone to be recognized in XCode. I highly recommend building a 1 scene game with a single cube or something to ensure your game will run on an iPhone before continuing. Don't fuss with IAP until you have a prototype running on the phone.
    3. I integrated the Prime31 StoreKit into my game (painless). One caveat, I'm a C# developer so this was kids play.
    4. I learned that (at least right now) the iTunes Connect developer site is where the magic happens (https://itunesconnect.apple.com):
    5. I went to "Manage Users" --> Test User --> Add New User
    6. Then I went to "Manage Your Applications" --> "Add a New App" and plugged in a bunch of values and stub images to get iTunes to actually create my game on their server.
    7. Once created you need to click on your game and in the "App Information" section click --> "Manage In-App Purchases" --> Create New
    8. Back in your code, make SURE you call StoreKitBinding.requestProductData() RIGHT BEFORE you call StoreKitBinding.purchaseProduct() as is stated on the Prime31 website. Otherwise you'll get the dreaded "Cannot Connect To iTunes Store" error. Totally logical... right? ...
    9. Delete the app off of the iPhone (just in case.. not sure if this is needed).
    10. On the phone: click Settings --> Store --> Tap the "AppleID" at the bottom --> Sign Out --> Sign In as your test user
    11. On your Mac: Click "App Store" --> Store --> Sign Out --> Sign in as your test user
    12. Now, finally, you can Build Run in Unity to test your IAP.

    Note 1: I'm not doing anything to re-run (not deleting the app, logging in-out). Simply rebuilding and running again.
    Note 2: The IAP purchase is NOT appearing in the App Store purchase history (sandbox purchase) BUT when I make the call to purchase again, iTunes Connect is indicating that the purchase was already made and asks if I'd like to download again. This was after a StoreKitBinding.purchaseProduct() call NOT a restoreCompletedTransactions() call.

    Hope this helps.
     
  10. Maccyfin

    Maccyfin

    Joined:
    Aug 19, 2012
    Posts:
    87
    Oh my god, this gave me a headache all night. As mehware mentioned, I reset my network settings and it works fine now. Go to:

    Settings > General > Reset > Reset Network Settings

    Phew :)
     
  11. francksitbon

    francksitbon

    Joined:
    Jan 22, 2010
    Posts:
    268
    Hi I'm creating my in-app purchase, but I wonder about this sentence in Itunes Connect :

    "The first In-App Purchase for an app must be submitted for review at the same time that you submit an app version. You must do this on the Version Details page. Once your binary has been uploaded and your first In-App Purchase has been submitted for review, additional In-App Purchases can be submitted using the table below."

    Should I build a special scene ? and send it to Apple ?
     
  12. mozzer7

    mozzer7

    Joined:
    May 18, 2013
    Posts:
    12
    I'm just going to jump in and offer another thing that might help those in the future.

    Spent a few hours trying to sort this out, only to realise I was still signed in my with NORMAL account on the App Store (Settings > iTunes and App Store).

    Once I'd done that it was fine.

    Obviously all the other stuff still needs to be done right, but it's worth mentioning just so people realise :)
     
  13. fnc12

    fnc12

    Joined:
    Oct 4, 2013
    Posts:
    2
    Had the same issue yesterday. Solved. The clue was pretty simple: go to iTunesConnect ->
    Contracts, Tax, and Banking -> Contracts amendments section -> press request button. Then toggle the checkbox and voila! Good luck.