Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts

Thursday, July 10, 2014

iOS Enterprise App Distribution

We have been going through the steps for building an app for iOS Enterprise distribution.  To make it
a little harder, the apps were being built in Xamarin.  However, the steps below works for Xcode too.  We finally conquered all the challenges -- and it wasn't super easy.  Here are a few items to remember for next time:

  • As of iOS 7.1, you must deploy your ipa file to an SSL cert site.
  • You must setup a distribution Provisioning Profile (from an Enterprise subscription).  Once you generate one, download it locally, then right click and "Install".  I had to restart Xcode for it to be recognized.

    With Xamarin, there was only one gotcha: After importing the Provisioning Profile, we had to go to the Project and right-click => Options.  Then go to "iOS Bundle Signing".  From there, we had to make sure the correct Identity was selected and the correct Provisioning Profile.  This was not auto-selected correctly.
  • Additionally, we had to go to iOS IPA Options and check the Build ad-hoc/enterprise package. No other options were filled on that screen.

  • When deployed to the website, when we clicked on the download link, we started receiving the error message:
Unable to Download Application
"Your Application" could not be downloaded at this time.
To fix this, we discovered that the URL that is built into the plist file has to be the full path to the ipa file, such as:


  • Finally, we had to set the mime type correctly.  We were using IIS, so:  Open IIS Manager, right-click on Server(local computer), select "MIME Types" => New.  Then add the following:

.IPA   - application/octet-stream 
.PLIST -  text/plain.

Once all that was corrected, we clicked on the link and auto-magically everything lit up and worked.  It's not super easy, but really flows nicely when it works correctly.

Thursday, June 12, 2014

iOS In-App Purchase Error - “Cannot connect to iTunes Store”

From Macgasm

It's true, In-App Purchases are awesome.  However, setting it up could drive you crazy.  I've personally spent too much time tracking this one “Cannot connect to iTunes Store” error down, so I decided to document the fix here.

If you are trying to do an In-App Purchase you might encounter this error.  It happens just as you send the product in for payment.  For me, its with a line like this:

SKPayment * payment = [SKPayment paymentWithProduct:product];

The weird thing is that the product is found just fine.  So, I know the connection to the iTunes Store is working fine.  However, it won't finalize the purchase.  It throws an error that gives (in my case) one of two errors: 0 or 1003.  You can find this error number by implementing the following (Which is taken from Ray Wenderlich's excellent IPAHelper):

- (void)failedTransaction:(SKPaymentTransaction *)transaction {
    if (transaction.error.code != SKErrorPaymentCancelled)
        NSLog(@"Transaction error: %@", transaction.error.localizedDescription);
    [[SKPaymentQueue defaultQueue] finishTransaction: transaction];


So, here is how I got both error codes to go away:

Error 0 - You must:
  1. Make sure you have accepted all the documentation terms and conditions within  Check under Contracts, Tax and Banking just to make sure.
  2. Make sure you are using a test user within the iPhone you are testing with.  To do this, go to iTunesConnect => Manage Users.  Then add a new test user.  Finally, on the phone you are developing with, go to Settings and sign out as your current user.  Sign in with the new test user you just made.  This should do it!

Error 1003 - This one seems to be a networking problem.  To clear this, I recommend you delete the App from your test device, Clean the project in Xcode, rebuild and re-deploy.

Another thing you should check is that Apple's service is up.  If you hit the following address, and you see no response, it's down.

Once you get In App Purchases working, its pretty sweet.  Good luck, its worth it!