Displaying Runtime errors using native.showAlert?

Hey guys,

My app is running perfectly fine in the OS X simulator.  However when I build for device, my app is having some runtime errors, but I have no idea what the problem is or what is happening.

What options do I have to figure out what it is in my code that is causing my app to throw runtime errors?  Is there a way to catch these and display them in a “native.showAlert”?

I ran it on my Android phone and was able to use “Catlog”, but even there all it says is that there are runtime errors and stack traceback, etc. No line numbers are displayed or anything.

None of this gives me a single clue of what is wrong with my code, any thoughts would be well appreciated.

I did find this link :http://www.coronalabs.com/blog/2013/03/06/run-time-error-handling/?utm_source=newsletter&utm_medium=email&utm_campaign=030713

It talks about how Corona is supposedly going to catch runtime errors automatically, but I never have it do it. I am running the latest daily build.

Rob posted a great blog post about this yesterday.  Check it out here: http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/.

Basically, you should be able to see runtime errors in the device using adb logcat for Android or the XCode console for iOS.  Follow the tutorial in the blog post and see if that helps.

  • Andrew

Wow thats great timing, thank you very much for the links, I will look all that over. Thanks again.

A quick question.  Have you come across the issue of having your app constantly bug you to enter login information when your app starts?  I have been testing IAP on my ipad, and for some reason my test apple ID keeps popping up asking for the password, I enter it in, but it continues to pop up in the future.  Using xcode from robs post I found that the console is saying "Warning: itunesstored (74) is trying to prompt for account credentials for account: " my test ID email.

Any idea whats up with this?

Are you calling store.restore() when your app launches?  That could be the reason.

  • Andrew

I’m not calling store.restore at launch.  Interestingly though, using xcode to debug, I can see that my store listener function is being called with a “successful” state right at launch.  This might be what is breaking my app on device. Going to try commenting out the require statement on my “store” code and see what happens.

Would it help if you had some print statements in your code and able to see them as ur using the app on ur device

I was able to get my error resolved, however the store stuff I think has to do with Apple.  Over the past few days their IAP testing server has been down or something strange has been going on.  Purchases take FOREVER, and so I think that some old store responses were finally coming back after a very long time.

Thanks for the response.

https://devforums.apple.com/message/852864#852864

Apple’s IAP sandbox is notoriously slow.  The prompt to login seems to be a sandbox side effect.

That must be whats going on.  Rob, I am now attempting to test Android IAP, and am having issues with getting any response on my transaction listener.

When I call store.purchase, google play pops up a message with the title of my IAP item and its price, whether I cancel or purchase the item, the window closes and I get no response to my transaction listener, thus my app is stuck in limbo.

Any idea why this would be happening?  I am using the same listener code for both IOS and Android, I assume it works for both platforms?

 I am using the following code: 

local function storeTransaction( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then --handle a successful transaction here print( "productIdentifier", transaction.productIdentifier ) print( "receipt:", transaction.receipt ) print( "signature:", transaction.signature ) print( "transactionIdentifier", transaction.identifier ) print( "date", transaction.date ) elseif ( transaction.state == "cancelled" ) then --handle a cancelled transaction here elseif ( transaction.state == "failed" ) then --handle a failed transaction here end --tell the store that the transaction is complete! --if you're providing downloadable content, do not call this until the download has completed store.finishTransaction( event.transaction ) end

@Rob, here is another user exeriencing the same issue.

http://forums.coronalabs.com/topic/36129-in-app-purchase-pop-up-wont-close/

Are there any errors in your device’s console log?

No errors are shown in the console log.  I just tested it using the “android.test.purchased”, and I get no responses if I try canceling it by using the hardware back button, and no response if I successfully purchase.  

Lets put responses on this thread so this dicussion is in only one place: http://forums.coronalabs.com/topic/36440-android-in-app-purchase-is-delivering-no-feedback-to-app/#entry192140

Rob posted a great blog post about this yesterday.  Check it out here: http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/.

Basically, you should be able to see runtime errors in the device using adb logcat for Android or the XCode console for iOS.  Follow the tutorial in the blog post and see if that helps.

  • Andrew

Wow thats great timing, thank you very much for the links, I will look all that over. Thanks again.

A quick question.  Have you come across the issue of having your app constantly bug you to enter login information when your app starts?  I have been testing IAP on my ipad, and for some reason my test apple ID keeps popping up asking for the password, I enter it in, but it continues to pop up in the future.  Using xcode from robs post I found that the console is saying "Warning: itunesstored (74) is trying to prompt for account credentials for account: " my test ID email.

Any idea whats up with this?

Are you calling store.restore() when your app launches?  That could be the reason.

  • Andrew

I’m not calling store.restore at launch.  Interestingly though, using xcode to debug, I can see that my store listener function is being called with a “successful” state right at launch.  This might be what is breaking my app on device. Going to try commenting out the require statement on my “store” code and see what happens.

Would it help if you had some print statements in your code and able to see them as ur using the app on ur device