Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Help! IAB crash on iOS — Gideros Forum

Help! IAB crash on iOS

totebototebo Member
edited August 2016 in General questions
I get a mysterious crash after I tap "buy" or "cancel" in the "Confirm your In-App Purchase" dialogue. When I debug in XCode I get a bunch of machine code errors, rather than readable stuff.

Any ideas?!

When debugging I've concluded that:

- The crash always happens if I use event listeners (Event.PRODUCTS_COMPLETE, Event.PRODUCTS_ERROR)
- If no event listeners are used it doesn't crash and the purchase appears to complete successfully. When I tap to purchase a second time, however, the app immediately closes down (without a dialogue).
- Exporting to iOS 7 doesn't solve the problem

Build info:
- Using 2016-06 "iab" plugin
- It's a modified version of GiderosiOSPlayer with the name and package changed to work with iTunes
- Also uses the "gaming" plugin, which works fine
My Gideros games: www.totebo.com

Comments

  • totebototebo Member
    edited August 2016
    Here is the log that XCode spits out. Each line comes with a nice bunch of machine code, but I think it's probably not useful.
    Thread 1Queue : com.apple.main-thread (serial)
    #0	0x000000010772a7b0 in NetworkBase::isConnected() const [inlined] at /Users/ar2rsawseen/gideros/libnetwork/libnetwork.cpp:255
    #1	0x000000010772a7b0 in NetworkBase::sendData(void const*, unsigned int) at /Users/ar2rsawseen/gideros/libnetwork/libnetwork.cpp:425
    #2	0x00000001077b9a34 in NetworkManager::printToServer(char const*, int) at /Users/ar2rsawseen/gideros/ios/iosplayer/iosplayer/giderosapi.mm:186
    #3	0x000000010767e335 in luaB_print at /Users/ar2rsawseen/gideros/lua/src/lbaselib.c:45
    #4	0x0000000107670b2f in luaD_precall at /Users/ar2rsawseen/gideros/lua/src/ldo.c:319
    #5	0x0000000107671600 in luaV_execute at /Users/ar2rsawseen/gideros/lua/src/lvm.c:587
    #6	0x000000010766d1ef in luaD_call at /Users/ar2rsawseen/gideros/lua/src/ldo.c:377
    #7	0x000000010766d163 in lua_call at /Users/ar2rsawseen/gideros/lua/src/lapi.c:782
    #8	0x000000010779abe6 in eventClosureWithData(lua_State*) at /Users/ar2rsawseen/gideros/luabinding/eventdispatcherbinder.cpp:931
    #9	0x0000000107670b2f in luaD_precall at /Users/ar2rsawseen/gideros/lua/src/ldo.c:319
    #10	0x000000010766d1de in luaD_call at /Users/ar2rsawseen/gideros/lua/src/ldo.c:376
    #11	0x000000010766d163 in lua_call at /Users/ar2rsawseen/gideros/lua/src/lapi.c:782
    #12	0x000000010779b84a in PushEventVisitor::visit(TouchEvent*) at /Users/ar2rsawseen/gideros/luabinding/eventdispatcherbinder.cpp:517
    #13	0x000000010779a74a in CppLuaBridge::luaEvent(LuaEvent*) at /Users/ar2rsawseen/gideros/luabinding/eventdispatcherbinder.cpp:838
    #14	0x00000001077d0666 in EventDispatcher::dispatchEvent(Event*) at /Users/ar2rsawseen/gideros/ios/iosplayer/../../libgideros/eventdispatcher.h:203
    #15	0x0000000107757c89 in Stage::dispatchToSpritesWithListeners(Event*) at /Users/ar2rsawseen/gideros/2dsg/stage.cpp:193
    #16	0x00000001077582b5 in Stage::touchesEnd(ginput_TouchEvent*, float, float, float, float) at /Users/ar2rsawseen/gideros/2dsg/stage.cpp:110
    #17	0x0000000107690b80 in gevent_CallbackList::dispatchEvent(int, void*) at /Users/ar2rsawseen/gideros/libgid/src/gevent.cpp:297
    #18	0x0000000107690955 in gevent::EventManager::tick() at /Users/ar2rsawseen/gideros/libgid/src/gevent.cpp:123
    #19	0x00000001077a1c97 in enterFrame(lua_State*) at /Users/ar2rsawseen/gideros/luabinding/luaapplication.cpp:1005
    #20	0x0000000107670b2f in luaD_precall at /Users/ar2rsawseen/gideros/lua/src/ldo.c:319
    #21	0x000000010766d1de in luaD_call at /Users/ar2rsawseen/gideros/lua/src/ldo.c:376
    #22	0x0000000107670631 in luaD_rawrunprotected at /Users/ar2rsawseen/gideros/lua/src/ldo.c:116
    #23	0x000000010766d2e9 in luaD_pcall at /Users/ar2rsawseen/gideros/lua/src/ldo.c:468
    #24	0x000000010766d282 in lua_pcall at /Users/ar2rsawseen/gideros/lua/src/lapi.c:821
    #25	0x00000001077de83b in ::lua_pcall_traceback(lua_State *, int, int, int) at /Users/ar2rsawseen/gideros/libgideros/luautil.cpp:172
    #26	0x00000001077a12e6 in LuaApplication::enterFrame(GStatus*) at /Users/ar2rsawseen/gideros/luabinding/luaapplication.cpp:1071
    #27	0x00000001077b8c69 in ApplicationManager::drawFrame() at /Users/ar2rsawseen/gideros/ios/iosplayer/iosplayer/giderosapi.mm:986
    #28	0x0000000107634d37 in -[ViewController drawFrame] at /GiderosiOSPlayer/ViewController.m:152
    #29	0x0000000108755bf4 in CA::Display::DisplayLinkItem::dispatch() ()
    #30	0x0000000108755abe in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
    #31	0x000000010af1c074 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
    #32	0x000000010af1bc21 in __CFRunLoopDoTimer ()
    #33	0x000000010aeddb11 in __CFRunLoopRun ()
    #34	0x000000010aedd0f8 in CFRunLoopRunSpecific ()
    #35	0x000000010beb3ad2 in GSEventRunModal ()
    #36	0x00000001088baf09 in UIApplicationMain ()
    #37	0x0000000107632e94 in main at /GiderosiOSPlayer/main.m:12
    #38	0x000000010b4b792d in start ()
    My Gideros games: www.totebo.com
  • Update: Tested with "Code example" from this URL:
    http://docs.giderosmobile.com/interface/iab

    This produced the exact same error as above. Could this be a Gideros issue perchance?
    My Gideros games: www.totebo.com
  • @totebo do you use that event on some coroutine or fake thread?
  • Also you have a print statement there? If you remove it, does it work correctly?
  • totebototebo Member
    edited August 2016
    @ar2rsawseen, thanks for response! It's what I consider a vanilla implementation, no funny business like threads or any modifications.

    I tried it without any prints, just the purchase() call and it behaves the same. Before the crash everything works, including loading the items from iTunes.

    It seems the purchase part is stable and works, even if the Gideros app flakes out; the app sometimes crashes before any dialogue is displayed, and then the dialogue displays on top of the home screen as if nothing had happened.
    My Gideros games: www.totebo.com
  • I start as much event stuff as possible outside of the fake thread - in the main lua code.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • hgy29hgy29 Maintainer
    @totebo,

    What kind of crash was it (BAD_ACCESS ?) and at which CPU address did it occur ?
    Reading the backtrace, it crashed in network code while trying to print something to gideros studio from your event callback in lua.
  • You're right, and it's very strange: If I print in the event listener it crashes. If I don't print in the event listener it doesn't crash the first purchase, but in the second. Same error, even if I remove all prints. Of course, I've checked the prints for undeclared vars.

    Yes, the error appears to be EXC_BAD_ACCESS. I don't understand the XCode output, but have attached a bunch of screenshots. What I have messed up now @hgy29?!
    Screen Shot 2016-08-23 at 09.57.09.png
    2282 x 1562 - 583K
    Screen Shot 2016-08-23 at 09.57.21.png
    2280 x 1564 - 565K
    Screen Shot 2016-08-23 at 09.57.28.png
    2278 x 1564 - 697K
    Screen Shot 2016-08-23 at 09.57.35.png
    2280 x 1562 - 701K
    Screen Shot 2016-08-23 at 09.58.03.png
    2276 x 1560 - 678K
    Screen Shot 2016-08-23 at 09.58.19.png
    2276 x 1556 - 677K
    Screen Shot 2016-08-23 at 09.58.11.png
    2274 x 1556 - 687K
    Screen Shot 2016-08-23 at 09.57.44.png
    2282 x 1560 - 675K
    Screen Shot 2016-08-23 at 09.58.28.png
    2278 x 1560 - 590K
    Screen Shot 2016-08-23 at 09.58.39.png
    2276 x 1562 - 698K
    My Gideros games: www.totebo.com
  • Update: I created a completely new Gideros project with just a main.lua containing the example from "Code example" from http://docs.giderosmobile.com/interface/iab. Items load fine, but same crash on purchase.
    My Gideros games: www.totebo.com
  • totebototebo Member
    edited August 2016
    I've attached the test project and the XCode output after the crash.

    Two videos showing the crash in action on an iPod Touch:




    It seems to me it has to be the plugin. Going back to triple check I've installed it correctly.
    txt
    txt
    xcode output.txt
    4K
    zip
    zip
    New Project.zip
    2K
    My Gideros games: www.totebo.com
  • totebototebo Member
    edited August 2016
    Update: As per @sinistersoft's instructions I exported a fresh XCode project from Gideros, and removed the assets folder. It made a player, yay! I added the IAB plugin and ran the project I attached above.

    Still the same error.

    I'm out of ideas. A clean player with a clean project with a clean plugin, using just the example code. Since my code is out of the loop, it has to be something to do with Gideros surely?!
    My Gideros games: www.totebo.com
  • ar2rsawseenar2rsawseen Maintainer
    edited August 2016
    So on all cases even without print it still crashes on print?

    I checked release notes for 2016.06 and it had nothing new regarding print, but had fake threads in it.

    Unfortunately if no one has any ideas, next step is finding last Gideros version on which it worked.
  • hgy29hgy29 Maintainer
    I traced the bug down to an issue with suspend/resume on iOS player, nothing wrong on IAB. Fix pushed to gideros repository.

    Likes: talis, totebo

    +1 -1 (+2 / -0 )Share on Facebook
Sign In or Register to comment.