I'd appreciate any advice you might have to help me through my in-app purchase blues. I've been reading the forums here and have reviewed the tutorial on in-app purchases.
I think I've set things up the way the should be, but have clearly missed something. Can you please help me figure out what it might be?
1. Created a new app listing in iTunesConnect
2. Created new in-app purchases in iTunesConnect
3. Linked my in-app purchases to my app in iTunesConnect
4. Left the new app in "Prepare for Upload" state
5. Created test user in iTunesConnect
6. on my device, signed out of iTunes
7. Coded my app (please see below) making sure to use the same in-app identifier used in iTunes Connect
8. Using xCode, installed app on my device
9. Ran app on my device
10. Attempted to initiate in-app purchase
11. via displayed dialog, I see app is "sendingRequest"
12. receive prompt to sign in to iTunes store (which I do with new test user)
13. via displayed dialog, I see app is "sendingRequest"
14. via displayed dialog, I see error: "Cannot connect to iTunes Store."
I'm hoping that I'm just over-tired and have missed something very obvious. Please help me see what that might be. I've included the relevant code below.
Thanks so much.
Joel
----------------
Code: Select all
in a button handler:
if line 6 of gPrefs ≠ "true" then
answer "Do you want to spend US$0.99 to...." with "Yes" and "No"
if it = "Yes" then
answer "Stand by while purchase is processed..."
mobilePurchaseCreate "com.projectiveart.1ThingDone.Shake"
put the result into tID
mobileEnablePurchaseUpdates
mobilePurchaseSendRequest tID
else
answer "Okay, maybe some other time..."
end if
----------------------------------
in my stack script:
on purchaseStateUpdate pPurchaseID
answer mobilePurchaseGet(pPurchaseID, "productID")&return&mobilePurchaseState(pPurchaseID)
switch mobilePurchaseState(pPurchaseID)
case "paymentReceived"
if mobilePurchaseGet(pPurchaseID, "productID") is "com.projectiveart.1ThingDone.Shake" then
put "true" into line 6 of gPrefs
else
put "true" into line 5 of gPrefs
end if
mobilePurchaseConfirmDelivery pPurchaseID
mobileDisablePurchaseUpdates
break
case "error"
answer "Error occured during purchase handling:" & return & return & mobilePurchaseError(pPurchaseID)
mobileDisablePurchaseUpdates
break
case "cancelled"
answer "Purchase cancelled."
mobileDisablePurchaseUpdates
break
end switch
end purchaseStateUpdate