Getting into LiveCode for iOS? Ask your questions here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
ace16vitamine
- Posts: 130
- Joined: Fri Apr 13, 2018 1:53 pm
Post
by ace16vitamine » Fri Nov 10, 2023 10:28 pm
Hi all,
I have a short question regarding this sample code. What I want: a simple iOS subscription after the button is pressed.
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "com.runrev.sampleapp.nonconsumable", "subs"
mobileStoreMakePurchase "com.runrev.sampleapp.nonconsumable", "1", "This belongs to me"
Is it right to replace "com.runrev.sampleapp.nonconsumable" with the SKU of the subscription?
Thanks
Stefan
-
jacque
- VIP Livecode Opensource Backer
- Posts: 7344
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Sat Nov 11, 2023 6:31 pm
The product ID is the bundle ID, the reverse-domain string you entered in standalone settings. Usually it starts with "com" or "org", etc. followed by the company name and then the app name.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
ace16vitamine
- Posts: 130
- Joined: Fri Apr 13, 2018 1:53 pm
Post
by ace16vitamine » Sat Nov 11, 2023 10:48 pm
OK, understand. But it is not clear for me how to assign the right subscription. It is possible to add multiple subs in AppStore with different SKUs.How can I tell LC which SKU is the right one?
-
jacque
- VIP Livecode Opensource Backer
- Posts: 7344
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Sun Nov 12, 2023 2:09 am
Sorry, I understand now. You can specify the product in mobileStoreMakePurchase. In the example, the product ID is "1", which you can substitute with your SKU.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
ace16vitamine
- Posts: 130
- Joined: Fri Apr 13, 2018 1:53 pm
Post
by ace16vitamine » Sun Nov 12, 2023 2:44 pm
Hi Jacky,
does not work, the app crashes.
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "the_bundle_id", "subs"
mobileStoreMakePurchase "the_bundle_id", "SKU", "This belongs to me"
if SKU = 1... Nothing happens (but no crash). If SKU = 1234567891 = Crash.
Same if I change the bundle id to a non existing id... For me it seems like a problem with the SKU
-
jacque
- VIP Livecode Opensource Backer
- Posts: 7344
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Mon Nov 13, 2023 6:12 pm
I'm not sure what would cause that, but LC should never crash so it's worth a bug report. Also, do you mean a crash (the app quits suddenly) or a hang (app is unresponsive)?
The SKU needs to be the same as the entry you set up in the developer console. Does your command match that exactly? Do they contain spaces or punctuation? I'm just guessing now.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
ace16vitamine
- Posts: 130
- Joined: Fri Apr 13, 2018 1:53 pm
Post
by ace16vitamine » Mon Nov 13, 2023 7:51 pm
Ive done this (copy/paste) from the LC Lesson and I replaced only the bundle ID & SKU.
The App crashed in iOS Simulator (quits) and also on physical devices without any answer. But only with my bundle ID & SKU not if I do this with the code from the lesson.
sure, it is the same SKU. Ive checked this with "123" -> No Problem. With "1234567890" -> quit. With my SKU (ABC123) -> Quit.
-
jacque
- VIP Livecode Opensource Backer
- Posts: 7344
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Tue Nov 14, 2023 2:43 am
I think at this point you should submit a bug report along with a sample stack. I'm afraid I'm out of ideas.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
LiveCode_Panos
- Livecode Staff Member
- Posts: 854
- Joined: Fri Feb 06, 2015 4:03 pm
Post
by LiveCode_Panos » Tue Nov 14, 2023 8:25 am
Hello Stefan and Jacque,
The correct syntax is this one:
Code: Select all
mobileStoreMakePurchase <productID>, <quantity>, <developerPayload>
So in this case. in the following script, you just have to replace "com.runrev.sampleapp.nonconsumable" with the SKU of the subscription, as it appears in the AppStore Connect page. Note that the subscription SKU is a different thing from the App ID that is entered in the iOS standalone settings.
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "com.runrev.sampleapp.nonconsumable", "subs"
mobileStoreMakePurchase "com.runrev.sampleapp.nonconsumable", "1", "This belongs to me"
Kind regards,
Panos
--
-
ace16vitamine
- Posts: 130
- Joined: Fri Apr 13, 2018 1:53 pm
Post
by ace16vitamine » Tue Nov 14, 2023 7:51 pm
Hi Panos:
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "SKU001", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
Right?
or should it be
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "my.bundle.id", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
-
Aduro91
- Posts: 45
- Joined: Sat Jul 22, 2023 8:49 pm
Post
by Aduro91 » Thu Jan 02, 2025 7:09 pm
ace16vitamine wrote: ↑Tue Nov 14, 2023 7:51 pm
Hi Panos:
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "SKU001", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
Right?
or should it be
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "my.bundle.id", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
Did you find out the answer to these issues? I am strugling to make a consumable purchase work
-
LiveCode_Panos
- Livecode Staff Member
- Posts: 854
- Joined: Fri Feb 06, 2015 4:03 pm
Post
by LiveCode_Panos » Mon Jan 06, 2025 9:24 am
Hello Aduro91,
Aduro91 wrote: ↑Thu Jan 02, 2025 7:09 pm
ace16vitamine wrote: ↑Tue Nov 14, 2023 7:51 pm
Hi Panos:
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "SKU001", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
Right?
or should it be
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "my.bundle.id", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
Did you find out the answer to these issues? I am strugling to make a consumable purchase work
The <product_ID> must be *exactly* the same as it appears in the App Store Connect listing. So, if it is listed as "SKU001", then you need to do:
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "SKU001", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
if it is listed as "my.bundle.id.SKU001", then you need to do:
Code: Select all
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "my.bundle.id.SKU001", "subs"
mobileStoreMakePurchase "my.bundle.id.SKU001", "1", "This belongs to me"
Hope this helps.
Kind regards,
Panos
--
-
Aduro91
- Posts: 45
- Joined: Sat Jul 22, 2023 8:49 pm
Post
by Aduro91 » Tue Jan 07, 2025 8:16 pm
Thanks so much Panos, I think the lack of a match was the problem for some time but the issue remained. What I realised eventually was that the Paid App Agreement in Apple Connect was pending user info. I hadn't filled in my bank details. This wasn't a necessity in previous times but now it is.
Thanks again