How to deliver and test IAP application for iOS

Hi, Ok I’m relatively new to this, so please go easy on me!

My app contains an in-app purchase element which I want to test. The following steps have already been taken.

  1. I have created both iOS Development and iOS Distribution certificates (for AdHoc)

  2. I have my App ID configured (which has In-App Purchases enabled)

  3. I have provisioning profiles for both iOS Development and iOS Distribution associated with the app ID - both marked ACTIVE

  4. In iTunes Connect I have my app listed with Bundle ID same as app ID

  5. In iTunes Connect I have my in-app purchase feature associated with this app ( marked as waiting for Upload )

  6. I have created a sandbox account for use with testing the in-app purchase

  7. I have used Application Loader to deliver in-app purchase

  8. I have installed the app using the AdHoc profile on my test device

So my questions are as follows:

  1. In iTunes Connect - the in-app feature is waiting for upload because I’ve asked Apple to host the content. I presume I need to use Application Loader to Deliver Your App , but selecting this asks me to choose a file, however the .app is not a valid file, and I’m therefore not sure what should be uploaded - or what I’ve missed.

  2. Is the problem that I’ve asked Apple to host the content. If I don’t do this, what is the best practice for managing customers who delete the app and then reinstall?

(I’ve just rechecked this by switching to saying no to host the content, and have the same issue still - so I must be doing something wrong)

  1. For sandbox user accounts, do these have to have valid email addresses, or can they be random and are recognised as valid for testing purposes?

  2. All indications are that I should be using the AdHoc profile for In-App purchase testing - is that correct?

Many thanks

aiv-andy,  Hope this helps.  to answer your questions…

  1. I recently (this week) tested some IAP on iOS.  Although I did not have Apple host the content, I created my IAP, created a test version of my app and loaded it on my iPad.  Using a sandbox account, I attempted a purchase, and everything worked.  I did not have to upload anything to Apple, but if you want others to test, you may have to do so via TestFlight.

  2. For users that uninstall/reinstall, add a “Restore Purchase” button, or at the very least, listen for a “restored” event.  See herefor details.

  3. (What happened to 3? lol) I believe the emails have to be valid.

  4. Correct.  Use an ad-hoc build for testing.

–john

Hi Schizoid

 

Thanks for the feedback:

 

  1. That’s OK. The question here was really about understanding what is needed to be done if you choose to have Apple host the in-app purchase. The docs state if you have them host it, you then don’t need to worry about management of whether a purchase has already been made or not etc., but they ask for your app to be delivered to them through Application Loader, but I can’t work out what should be uploaded.

 

  1. Yes - I listen to the restored event, but as the example goes, there’s no action other than allowing the transaction to complete that needs to be taken. Incidentally, without Apple hosting the in-app purchase, in the sandbox environment I still get a message during purchase saying the app was previously purchased and it works without having to pay twice. Therefore I assume this has gone through the “restored” path. But I was then puzzled as I would have expected this only to work if Apple hosted the in-app purchase?

 

  1. You are correct - I solved 3 myself and amended the question!   :slight_smile:

 

  1. Actually I’ve tried using the sandbox with an arbitrary email address and this works fine. As long as you’re signed out of the Store, when it comes to the purchase, you can use any sandbox email and it will be granted. It does however subsequently ask you to sign-in and set up account details, but that can be safely ignored.

 

  1. Great - thanks

 

It does work (for non-consumable items) even if Apple does not host your content.  I include a restore button in my apps and do not host anything outside. For consumable, you are allowed to purchase over and over again, and the restore listener is not fired for those.

–john

aiv-andy,  Hope this helps.  to answer your questions…

  1. I recently (this week) tested some IAP on iOS.  Although I did not have Apple host the content, I created my IAP, created a test version of my app and loaded it on my iPad.  Using a sandbox account, I attempted a purchase, and everything worked.  I did not have to upload anything to Apple, but if you want others to test, you may have to do so via TestFlight.

  2. For users that uninstall/reinstall, add a “Restore Purchase” button, or at the very least, listen for a “restored” event.  See herefor details.

  3. (What happened to 3? lol) I believe the emails have to be valid.

  4. Correct.  Use an ad-hoc build for testing.

–john

Hi Schizoid

 

Thanks for the feedback:

 

  1. That’s OK. The question here was really about understanding what is needed to be done if you choose to have Apple host the in-app purchase. The docs state if you have them host it, you then don’t need to worry about management of whether a purchase has already been made or not etc., but they ask for your app to be delivered to them through Application Loader, but I can’t work out what should be uploaded.

 

  1. Yes - I listen to the restored event, but as the example goes, there’s no action other than allowing the transaction to complete that needs to be taken. Incidentally, without Apple hosting the in-app purchase, in the sandbox environment I still get a message during purchase saying the app was previously purchased and it works without having to pay twice. Therefore I assume this has gone through the “restored” path. But I was then puzzled as I would have expected this only to work if Apple hosted the in-app purchase?

 

  1. You are correct - I solved 3 myself and amended the question!   :slight_smile:

 

  1. Actually I’ve tried using the sandbox with an arbitrary email address and this works fine. As long as you’re signed out of the Store, when it comes to the purchase, you can use any sandbox email and it will be granted. It does however subsequently ask you to sign-in and set up account details, but that can be safely ignored.

 

  1. Great - thanks

 

It does work (for non-consumable items) even if Apple does not host your content.  I include a restore button in my apps and do not host anything outside. For consumable, you are allowed to purchase over and over again, and the restore listener is not fired for those.

–john