danfreeman / in-app-purchase-air-ios

Automatically exported from code.google.com/p/in-app-purchase-air-ios
0 stars 1 forks source link

Does this work in CS5 / ActionScript #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm really keen to use this library but all my projects have been developed in 
Flash / AS3.

Can someone describe how we do this using CS5 Actionscript instead of Flex? Is 
there a CS5 sample project somewhere we can use?

Thanks

Leon

Original issue reported on code.google.com by lgcadeb...@googlemail.com on 26 Oct 2011 at 12:40

GoogleCodeExporter commented 9 years ago
Thank you for posting this issue, Leon.

I am also interested in developing via Flash CS5.5 + AS3 and so far I haven't 
found any answers regarding developing iOS In-App purchases with this native 
extension.

I hope that the person/persons developing this project can respond with an 
example .fla  showing us how.

Original comment by hybridth...@gmail.com on 28 Oct 2011 at 2:40

GoogleCodeExporter commented 9 years ago
Hi:
Yes this does work with Flash CS 5 also.

http://help.adobe.com/en_US/air/build/WS597e5dadb9cc1e0253f7d2fc1311b491071-8000
.html#WS08cc5e527b0868243ea2ffcd1314dff873a-7ffc this might be of help. But 
instead of renaming the ane to swc use the swc provided in the zip file.

I will soon post the exact steps to use this native extension in Flash Pro IDE 
on the Wiki Page.

Original comment by saumitra...@gmail.com on 1 Nov 2011 at 4:26

GoogleCodeExporter commented 9 years ago
Thanks, I look forward to the wiki page explaining the process of developing 
with Flash CS5 and/or CS5.5 . 

On the wiki page if you could also add an example .fla, that would be great.

Original comment by hybridth...@gmail.com on 1 Nov 2011 at 4:51

GoogleCodeExporter commented 9 years ago
Hi,

Any news about the exact steps to use this native extension in Flash Pro IDE or 
Flash Develop?

Thank you!

Original comment by andrei_2...@yahoo.com on 3 Nov 2011 at 6:44

GoogleCodeExporter commented 9 years ago
Hi: before I document(Which will take some time for me) I am just giving quick 
steps here.
0. Follow the UseBinaries tutorial till step 2. For step 3 use following steps.
1. Go to File -> Actionscript Settings.
2. In the dialog open the Library path
3. Click '+' to add a new row.
4. Click on the button with flash symbol on it (Just to the right of '-')
5. Locate the SWC given in binaries.
6. You can see the swc listed in the table. Click on the small triangle to 
expand the SWC properties, You can see a sub-row called Link Type
7. Double click on link type.
8. In the new window change Link Type to 'External' press Ok to close both 
dialogs.
9. Now all In App Purchase APIs will be available to your Flash Application. 
Write the code and save/compile it to get the SWF File.
10. Now you are at the point where you have SWF File,App XML and ANE given in 
binaries. Now you can continue the UseBianaries tutorial from step 4 to 
generate ipa 

Can you guys try out these steps and let me know if you have any issues?

Original comment by saumitra...@gmail.com on 4 Nov 2011 at 1:31

GoogleCodeExporter commented 9 years ago
Steps for Flash Develop:

1. Follow UseBinaries tutorial. For step 3 use following steps.
2. Go to project properties and in the external libraries provide path of the 
SWC thats provided in zip archive.
3. Follow the tutorial from step 4 to generate the ipa

Original comment by saumitra...@gmail.com on 4 Nov 2011 at 1:39

GoogleCodeExporter commented 9 years ago
The usage sample is essentially in actionscript it just uses flex for events 
like button click. You can just go through the content inside <fx:script> You 
can call those APIs in your frames actionscript content as well.

Original comment by saumitra...@gmail.com on 4 Nov 2011 at 1:56

GoogleCodeExporter commented 9 years ago
I followed you steps and I can't get it to work. If I change my app-xml file as 
below (is that right?) and try to run it in CS5 it comes up with "Debugger 
failed". If I take the extension section out I get:

VerifyError: Error #1014: Class com.adobe.nativeExtensions::AppPurchaseEvent 
could not be found

Can you confirm the content of the XML file?

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/2.6">

  <id>com.iosapp.testapp</id>

  <versionNumber>1.1.1</versionNumber>

  <versionLabel/>

  <filename>UI</filename>

  <description/>

   <extensions>

          <extensionID>com.adobe.appPurchase</extensionID>

    </extensions>   

Original comment by da...@brain-media.co.uk on 7 Nov 2011 at 11:13

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I am re-organizing my reply so its easy to follow:

1. Keep Namespace 3.0 for Application descriptor. Currently its 2.6.
2. Apologies there is no need to change SWF Version
3. CS 5 is actually not aware of the native extension feature hence creating 
ipa from Flash CS 5 wont help. You need to create ipa with ADT Command line 
tool that comes with AIR 3 SDK.

"Are you using the -extdir switch in ADT" - I thought the ADT was as Flex 
thing? Do I need to use that / how do I specify this compile directive in CS5 
or am I missing something here. --> The link given in useBinaries 5th step 
shows how you can create ipa from SWF and APP XML you need to use -extdir 
switch in that command.

Original comment by saumitra...@gmail.com on 7 Nov 2011 at 11:58

GoogleCodeExporter commented 9 years ago
OK Cool and the way I added the extensions bit to the XML file is fine / is the 
extensionID correct?

<extensions>
    <extensionID>com.adobe.appPurchase</extensionID>
</extensions> 

Original comment by lgcadeb...@googlemail.com on 7 Nov 2011 at 12:06

GoogleCodeExporter commented 9 years ago
Yes, It is.

Just change <application xmlns="http://ns.adobe.com/air/application/2.6"> to 
<application xmlns="http://ns.adobe.com/air/application/3.0">

Original comment by saumitra...@gmail.com on 7 Nov 2011 at 12:11

GoogleCodeExporter commented 9 years ago
any luck with the fla file for flash cs 5/5.5 ? :)
I am trying to code the app based on the flex code you provided, but i am lost.
thanks!

Original comment by rares.fxstudio@gmail.com on 22 Nov 2011 at 2:56

GoogleCodeExporter commented 9 years ago
I too would like an .fla example for CS 5.5 

Original comment by hybridth...@gmail.com on 22 Nov 2011 at 3:59

GoogleCodeExporter commented 9 years ago
Hi did you try try the steps mentioned in earlier comments? Are there any 
specific issues you are facing?

I think this link can help as well 
http://help.adobe.com/en_US/air/build/WS597e5dadb9cc1e0253f7d2fc1311b491071-8000
.html

Original comment by saumitra...@gmail.com on 23 Nov 2011 at 8:56

GoogleCodeExporter commented 9 years ago
hey , so my specific challenge...I am trying to make this work in with flash 
CS5.5
i compiled the app, all ok , but when it's down to getting the product, i get 
nothing.
What i did:
i have created a app placeholder, in that app placeholder i added a product for 
in app purchase. 
now this product has this status:
-Reference Name    
 AttendaceApp  
-Product ID    
 attendanceApp  
-Type    
 Non-Consumable  
-Status  
 Ready to Submit  
now,
I tryed to get the item with this: 
AppPurchase.manager.getProducts(["attendanceApp"]);
but i got no products.
I wonder ... do i need to submit the actual product for review ? because i see 
the status is .. ready for submit...? if so, then i will need to submit it with 
the actual app, and that is not complete :)
Any thoughts?

Original comment by rares.fxstudio@gmail.com on 23 Nov 2011 at 1:51

GoogleCodeExporter commented 9 years ago
Hello,

So I have the .ane file and the .swc in my lib folder and the .swc is in there 
as an external library. I added the extensions node to my xml properly. I have 
some confusion on the whole adt command line process. As of right of right now 
when I try to compile it gives me the message that it cannot find the extension 
at hand. Do I use just a regular command line in windows? Is there a command 
line located within Flash Develop at all?

Thanks for your time!

Original comment by kashaniz...@gmail.com on 23 Nov 2011 at 6:26

GoogleCodeExporter commented 9 years ago
hey, this is what i used to compile, and it worked for me.
z:\AdobeAIRSDK\bin\adt.bat -package -target ipa-ad-hoc -storetype pkcs12 
-keystore "LOCATION TO YOUR CERTIFICATE HERE" -storepass "CERTIFICATE PASSWORD" 
-provisioning-profile "YOUR mobileprovision FILE" "YOUR_IPA.ipa" 
"YOUR_APP_XML.xml" "THESWF.swf" -extdir "appPurchasePrefixed_folder"

Original comment by rares.fxstudio@gmail.com on 23 Nov 2011 at 6:29

GoogleCodeExporter commented 9 years ago
is that in a batch file? if so which one?

Thank you for replying!

Original comment by kashaniz...@gmail.com on 23 Nov 2011 at 6:52

GoogleCodeExporter commented 9 years ago
you just execute it in the command line, just change the first path to your 
folder of AIR sdk.

Original comment by rares.fxstudio@gmail.com on 24 Nov 2011 at 7:59

GoogleCodeExporter commented 9 years ago
OK, so here is my packager.bat file http://pastebin.com/z8zM61qq
I put both ane's and the swc file in my lib folder. I added my swc as an 
external library.I added my extension nodes in my xml as well.  For some reason 
flash develop says it cannot find the extension.

Any ideas?

Thank you for your time!

Original comment by kashaniz...@gmail.com on 24 Nov 2011 at 5:15

GoogleCodeExporter commented 9 years ago
the packager is quite a lot of text there, i hope you have it correct :)
now.. packager.bat is executed after you create the swf. when do you get the 
error ? when you compile de swf from flash, correct ? 
what export options do you have on export? what flash player ?

Original comment by rares.fxstudio@gmail.com on 24 Nov 2011 at 6:20

GoogleCodeExporter commented 9 years ago
When I run it normally I have my little hello world program up and running from 
flash develop. I even uploaded my hello world app to the ipad and it worked. 
It's the moment I add the extension to the application descriptor. I am 
assuming the that I put the ane and swc files in the right folder and that 
works correctly. For some reason it cannot see where I have placed the ane file.

This adt part is where it gets confusing. Can you compile your project and have 
it run with the native extension on your desktop? or do I have to test it on an 
ipad?

Original comment by kashaniz...@gmail.com on 24 Nov 2011 at 6:28

GoogleCodeExporter commented 9 years ago
:) you definitely have to test it on your device.
the adt part converts the swf to ipa. ipa runs on your ios device.

Original comment by rares.fxstudio@gmail.com on 24 Nov 2011 at 6:34

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi,

I am trying to compile the swf using Flash CS5.5 with Adobe AIR 3.1 overlayed, 
and it doesn't work.

Some observations:

* The zip file I used (appPurchasePrefixed.zip) contains a single swc (AS.swc)

* When I link AS.swc in Flash CS5.5, if I select the 'external' option (rather 
than 'Merged into Code'), then when compiling, I get this error message:

"Class com.adobe.nativeExtensions::AppPurchaseEvent could not be found."

* If, however, I use 'Merged into Code' for linking AS.swc (which apparently 
we're not supposed to), then the compiler does find Saumitra's classes, but I 
get a different error message:

    at com.adobe.nativeExtensions::AppPurchase()[/Users/airqe/work/Repos/in-app-purchase-air-ios/branches/v1/AS/src/com/adobe/nativeExtensions/AppPurchase.as:21]
    at com.adobe.nativeExtensions::AppPurchase$/get manager()[/Users/airqe/work/Repos/in-app-purchase-air-ios/branches/v1/AS/src/com/adobe/nativeExtensions/AppPurchase.as:30]

* Also, if I add the following to the app descriptor, then Flash CS5.5 refuses 
to even try to compile the swf (I guess you have to compile the swf first, then 
modify the manifest, and then use adt):

 <extensions>
      <extensionID>com.adobe.appPurchase</extensionID>
</extensions>

Original comment by pas...@lisieremedia.com on 2 Dec 2011 at 12:42

GoogleCodeExporter commented 9 years ago
use EXTERNAL  for the swf NOT merged into code, just follow the instructions.. 
improvising will only lead you to failure.
you need to check the demo code provided, it will work. it works for me.
you will get 1 error on the class when compiling the swf:
VerifyError: Error #1014: Class com.adobe.nativeExtensions::AppPurchaseEvent 
could not be found.
It's normal. ignore it.
You will get a swf, then use the adt.
have fun :)

Original comment by rares.fxstudio@gmail.com on 2 Dec 2011 at 1:35

GoogleCodeExporter commented 9 years ago
Hi Pascal:

Rares suggestions should work. About extensions tag, I would recommend having a 
copy of xml with that tag and use the copy with ADT.

Please post back in case you face any issues.

Original comment by saumitra...@gmail.com on 2 Dec 2011 at 8:08

GoogleCodeExporter commented 9 years ago
Is it possible to test native extensions within flash develop? I don't mean the 
ipa I just mean the swf.

Original comment by kashaniz...@gmail.com on 2 Dec 2011 at 8:17

GoogleCodeExporter commented 9 years ago
Hi Rare & Saumitra,

Thank you for your help: the code appears to work so far!

The key for me was understanding that 'VerifyError: Error #1014: Class 
com.adobe.nativeExtensions::AppPurchaseEvent' is a normal error message when 
compiling with CS5, but that you nevertheless get a usable swf out of it 
(packageable with adt).

The only bummer with this though, is that any OTHER error messages (due to my 
customized test code) won't show up when compiling with CS5--so I am 'blind'.  
If I make a mistake, the app will crash on the device and I will not be able to 
know what happened.

Also, for those of us that use CS5 rather than Flex, 'ArrayCollection', 
'IndexChangeEvent' from the sample file are not accessible (I couldn't find a 
swc with them in it).  It's not a huge deal, though, since one can code around 
them.

Finally, duplicating the manifest xml, and adding the 'extension' tag line in 
the duplicate is the way to go, since otherwise this line stalls CS5 when 
compiling OR loading your fla.

I'll post my 'CS5-legal' test bed, when I get it fully working.  Right now, I 
need to figure out how to create a test user account in the Sandbox 
Environment...

Original comment by pas...@lisieremedia.com on 3 Dec 2011 at 3:59

GoogleCodeExporter commented 9 years ago
@ Pashani - from what i know, you can't.
@ Pascal - The array collection is just an... Array :) replace it with array 
and you are set to go, and indexchangeevent is just an event triggered when the 
user selects something in a list or a combo box, something similar is triggered 
in flash when you change your selection, for sure.

Original comment by rares.fxstudio@gmail.com on 3 Dec 2011 at 10:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You are welcome to contribute this example in the source. I will be
creating a folder "Examples". Basically, It will be great to have one
Flash Pro,Flash Builder, Flash Develop Project in there.

Original comment by saumitra...@gmail.com on 4 Dec 2011 at 8:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hey Saumitra,

Minor detail: I noticed that, in my case, Product.priceLocale() returns 
"en_US@currency=USD".  Shouldn't it be just "USD" instead?

Original comment by pas...@lisieremedia.com on 4 Dec 2011 at 8:29

GoogleCodeExporter commented 9 years ago
Hi:

Hi: It has both the Info. Locale as well as currency accepted for that
locale. The reason behind this is that the title, description etc. are
locale based and to know what locale was retrieved you can use this
value.

Original comment by saumitra...@gmail.com on 4 Dec 2011 at 8:50

GoogleCodeExporter commented 9 years ago
Hi Saumitra & Rares,

It works!  Thank's a lot for your help!!!

Here is my little testbed, using CS5.5 (with AIR 3.1 overlayed).

It's basically a manually scrollable textfield (to see the trace log on iOS), 
and 2 buttons: one to get the list of in-app products from the apple app store, 
and the other to buy product 0 (hard-coded for testing purposes).

As mentioned above, when compiling on CS5.5, you will get an error: just click 
on 'Dismiss All', and use adt to compile the swf that was created.  As noted 
also, you will need a duplicate manifest xml and add to it the the 'extentions' 
line (as CS5.5 doesn't like it if you add the extensions line to the main 
manifest).

Installation:

0) Edit the supplied InAppPurchasesTest.as, and replace the product ids in the 
constant named 'productIdsOffered' to match the product ids you have created 
for your app in iTunes Connect.
1) Open the fla, and point CS5.5 to wherever Saumitra's AS.swc is intalled on 
your HD.  Make sure the swc is set to 'external' (NOT 'merged into code').
2) In the publish settings, change the name/id of the app to match the test app 
you have added to iTunes Connect
3) Compile the swf
4) Make a copy of the manifest xml, and add the 'extensions' line to it.
5) Edit the supplied batch file with your specific info, and launch it.
6) Copy the ipa you have created to your device via iTunes (an ad-hoc ipa).

Other things you'll need:
  1) Create a test user account on iTunes Connect
  2) Create and download an ad-hoc publishing profile for your app (can't compile the ipa without it).

Original comment by pas...@lisieremedia.com on 4 Dec 2011 at 9:10

Attachments:

GoogleCodeExporter commented 9 years ago
awesome! very happy you got it working! 
Thank you for sharing your example and a BIG "thank you" to Saumitra for 
creating this extension:)

Original comment by rares.fxstudio@gmail.com on 4 Dec 2011 at 10:06

GoogleCodeExporter commented 9 years ago
Hi Saumitra,

Quick question:

If I minimize my testbed app, wait a while, and then maximize it again, I get 
prompted to re-log into my test user account.

Ideally, in a real-world app, I would like the user to be prompted to log-in 
ONLY IF the user navigates to the app's in-app purchase interface, but as soon 
as the user moves away from the purchase interface, then I would like the app 
to stop requiring/checking that the user is logged into their account.  How can 
I do that?

In other words: is there a way to close the app purchase manager's connection, 
and restart it at will?

Another thought: maybe this has nothing to do with the purchase manager?  Do 
all apps that have in-app products for sale on iTC, automatically require a 
log-in???

Original comment by pas...@lisieremedia.com on 4 Dec 2011 at 12:47

GoogleCodeExporter commented 9 years ago
This log-in dialog box is handled by iOS itself the developer (even
the native developer) do not have any functionality to
connect/disconnect from the store.

The best bet would be to follow all the iOS developer guidelines,
Empty the queue ASAP by doing finish transaction(for cancelled as well
as for successfull).

I hope this helps.

Original comment by saumitra...@gmail.com on 4 Dec 2011 at 12:53

GoogleCodeExporter commented 9 years ago
Your sample finishes transactions for all purchased, as well as all restored 
that were previously purchased.

In my test case, I don't think I had any other pending (un-finished) 
transactions in the queue, and I nevertheless get prompted when I maximize the 
app after a period of inactivity.

So I guess what you mean is that developers can't disable/avoid the log-in 
window from popping up?

Original comment by pas...@lisieremedia.com on 4 Dec 2011 at 1:06

GoogleCodeExporter commented 9 years ago
Hi Saumitra,

Here is my updated testbed, with a few more buttons.  It's all manual, this 
time.

Regarding the issue of the unwanted login pop-up I mentioned in my last message:

1) It turns out that I had a bunch of unfinished transactions, causing the 
login pop-up window to appear, after maximizing the app following a period of 
inactivity (I would actually wait for the device to lock, with password 
protection enabled -- not sure if that makes a difference or not).

2) Finishing all the unfinished transactions in the queue resolved the problem: 
no more unwanted login pop-up.

3) Note: restoring transactions always brings-up the login pop-up window, no 
matter what.

4) I believe there was a bug in the sample: when restoring a previously 
purchased transaction, the transaction should be finished using the current 
transaction identifier rather than the original transaction identifier.  Using 
the orignal transaction ID was causing the transaction to remain in the queue, 
and thus I believe cause the login pop-up to appear when maximizing the app 
after a period of inactivity.

Questions/Notes:

a) Regarding AppPurchase.muted: I looked into the Settings on my device and 
didn't find any switch to disable store purchases.  Am I understanding how 
'muted' is used correctly?

b) Also, I noticed the sample doesn't check the 'muted' variable each time it 
starts a payment--shouldn't it?

c) Finally, I found a typo: TRANSACTION_STATE_PUCHASING + 
TRANSACTION_STATE_PUCHASED <-- omitted the "R" in both constants ( this might 
lead to a bug if more that one person works on the code and makes the wrong 
assumption :).

Original comment by pas...@lisieremedia.com on 5 Dec 2011 at 7:30

Attachments:

GoogleCodeExporter commented 9 years ago
Testbed update (minor tweaks).

Original comment by pas...@lisieremedia.com on 5 Dec 2011 at 12:36

Attachments:

GoogleCodeExporter commented 9 years ago
Hi, can anyone help with setting iTunes Connect up for In App Purchases?

I'm using FB4.6 running this code on my iPhone 4S.
All seems fine but don't get anything returned to the list.

I've added my product ids (same as I've added to iTunes Connect In-App 
Purchases) to the getProducts() button handler.

Running the .ipa in debug mode on my 4S, when I click the 'getProducts' button 
all products are returned as 'Invalid Identifiers'.

Using reverse domain ids for my app id & in-app purchase ids.

Thanks, Neil

Original comment by NeilKightley on 14 Dec 2011 at 5:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]