the dreaded cannot connect to iTunes - inapp purchase problem

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

the dreaded cannot connect to iTunes - inapp purchase problem

Post by mvillion » Thu Oct 05, 2017 9:02 pm

Hi all
I am trying to get in app purchases working and going in loops. Apart from the IOS 11 issue when testing, now resolved, I cannot get the purchase to go through.

It pops up the prompt for user name and password but will not go passed it reporting 'cannot connect to iTunes'.
I have noticed that if i deliberately use an incorrect password it reports that, so I know it is talking to the back end some where

The code is simple
if mobileStoreCanMakePurchase() is true then
answer "Purchasing is available"
mobileStoreRequestProductDetails "com.squidsecurity.baseline.fullreport01"
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "com.squidsecurity.baseline.fullreport01", "inapp"
mobileStoreMakePurchase "com.squidsecurity.baseline.fullreport01", "1", "This belongs to me"
else
answer "In-app purchasing is not supported"
end if

Reference Name = 'Full Report'
Product ID = 'fullreport01'

The process is used
1. Create new email account.
2. Verify email account from email from Apple
3. Add new user to sandbox users
4. Create in-app purchase
5. Upload new binary with the in-app code
6. link the two
7. Sign out of device is Setting> iTunes account
8. Upload a new binary onto the device
9. Test (and fail)

I have read every post I can find in both in Livecode and on the Apple sites. Nothing I do gets passed this point

Any thoughts gratefully received
Last edited by mvillion on Thu Oct 05, 2017 11:06 pm, edited 1 time in total.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: the dreaded cannot connect to iTunes - inapp purchase problem

Post by LiveCode_Panos » Thu Oct 05, 2017 9:36 pm

Hi Matt,

What is the "status" of your in-app purchases in the iTunes Connect? I think their status should be "ready to submit", in order to be ready for testing.

You can see their status after choosing your app and going to Features -> In-App Purchases.

Best,
Panos
--

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Re: the dreaded cannot connect to iTunes - inapp purchase problem

Post by mvillion » Thu Oct 05, 2017 10:39 pm

Good question. I should have posted this..

The in-app is 'ready to submit'
The main application is 'Prepare for submission' with a 'Submit for review' button available.
All metadata questions have been answered.

If it matters, I coded it in LC 8.1.7 rc1

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: the dreaded cannot connect to iTunes - inapp purchase problem

Post by LiveCode_Panos » Fri Oct 06, 2017 12:40 pm

Hmm,

The In-App Purchase ID (com.squidsecurity.baseline.fullreport01) is associated with a specific App ID in the iTunes Connect. Are you using this specific App ID in the "Internal App ID" field of the iOS Standalone Application Setting?

Best,
Panos
--

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Re: the dreaded cannot connect to iTunes - inapp purchase problem

Post by mvillion » Fri Oct 06, 2017 12:55 pm

Ok. I am not understanding the question.
Can I please ask what you mean by 'Are you using this specific App ID in the "Internal App ID" field of the iOS Standalone Application Setting?'

If you are meaning is the setting within LiveCode standalone setting under the iOS application name 'com.squidsecurity.baseline' then yes.

the 'fullreport01' is the name of the in-app purchase so I added that onto the name of the Internal App ID to form
'com.squidsecurity.baseline.fullreport01' as the requested item to purchase. Is that incorrect?

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: the dreaded cannot connect to iTunes - inapp purchase problem

Post by LiveCode_Panos » Fri Oct 06, 2017 1:33 pm

Aha!

This is probably the cause of the problem. So:

- The parameter passed to <mobileStoreSetProductType> and <mobileStoreMakePurchase> must match *exactly* the in-app purchase "Product ID" as it appears in the iTunes Connect. So, if 'fullreport01' is **the Product ID** (not the name!) of this in-app purchase, then you should use:

mobileStoreSetProductType "fullreport01", "inapp"
mobileStoreMakePurchase "fullreport01", "1", "This belongs to me"

Hope this helps,
Panos
--

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Re: the dreaded cannot connect to iTunes - inapp purchase problem

Post by mvillion » Fri Oct 06, 2017 1:50 pm

You little ripper. (Australian expression meaning super good).

It worked. Many thanks.


I did try that earlier but it was being masked by a separate problem with the authentication bug the exist with sandbox testing with a repeating authentication (even if you did get everything correct) since ios11.

The solution to that issue is this: (As discovered in one of the apple forums)
Once you have uploaded the app to the device for testing, attempt to purchase the product.
Enter the username and password. (It will not accept them and it will ask for the credentials again)
Press the home button (effectively termination the purchase cycle)
Run the app again.
Attempt to purchase again. This time you will only be asked for the password.
Success!!!

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: the dreaded cannot connect to iTunes - inapp purchase problem

Post by LiveCode_Panos » Fri Oct 06, 2017 1:52 pm

Hi Matt,

This is great, I am glad it worked :)

Best regards,
Panos
--

Post Reply

Return to “iOS Deployment”