App crashes when Archived using Release but works fine with Debug...

Discussion in 'iOS Programming' started by dbramhall, Sep 11, 2011.

  1. dbramhall macrumors newbie

    Joined:
    Aug 1, 2011
    Location:
    England, UK
    #1
    I am developing a tab bar-based application for iOS and I have submitted it to the App Store however it has been rejected because it crashes when one presses the second and third tab (there's four tabs) however this was not the case when I was debugging the application for two iOS devices and the iOS Simulator and I have Archived the application, installed it on an iOS device using iTunes and it does indeed crash... I was therefore wondering why it doesn't work when it's built with Release and why it does work flawlessly when built with Debug...

    Anyway, here's the crash log: http://cl.ly/A13A and I was wondering if anyone could have a look and let me know because I'm rather stuck right now and cannot isolate the problem...
     
  2. PhoneyDeveloper, Sep 11, 2011
    Last edited: Sep 11, 2011

    PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    It crashes because there's a bug.

    Before submitting an app to the app store you need to test adhoc builds. These are most similar to the app that apple will test and your users will use. As you've discovered, it's always possible for there to be bugs that are only revealed in your release build, or only revealed when running on the device without the debugger, or with the device untethered. It's essential that you do some testing like this. It's best if you have beta testers who will test for you as well.

    Looking at your crash log what I see is an assertion failure, or SIGABRT. It happens at LingoTableViewController.m:220 where you alloc/init a label. The assertion failure occurs after the frame or bounds are set for the label or its layer. There is a common assertion failure if you set the frame and one of the fields in the frame is a nan or otherwise is an invalid floating point value.

    When an app is killed due to a SIGABRT there is some text in the device console that describes the cause. You should be able to find that text.

    You may be able to debug this simply by changing your Run scheme to use the Release build instead of the Debug scheme or by using log statements. Debugging release builds can be awkward.

    Most likely there is a bug in your code that is revealed by the optimizer. Something like an uninitialized variable. Does the static analyzer report anything?
     
  3. dbramhall thread starter macrumors newbie

    Joined:
    Aug 1, 2011
    Location:
    England, UK
    #3
    Sure, but The first tab bar view is a tableview that contains the same code as the other two tabs and that's works fine.
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    What's your point?

    There's a bug that's causing your app to throw a SIGABRT under some circumstances. Your job is to find it.
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    Maybe you can use that fact to help you find the bug. If the code is the same, but only one crashes, what can cause the fatal difference?

    Maybe the data is different. Maybe some other resource is different.

    Don't get too obsessed following this path, because it could be worthless. The real cause could be an uninitialized variable in some other place in the code, and it's the timing of when the code executes that causes the crash. Or a variable is under-retained. Or other things.
     
  6. adjwilli macrumors newbie

    Joined:
    Apr 17, 2012
    #6
    Ad Hoc distribution to check

    I recently had a similar problem where my app crashed in distribution builds but not in development builds. I'm still not sure why it happened but I fixed it and here is what helped me.

    First, you need to test your app with ad hoc distributions. This is the only way to troubleshoot you app like it will appear in the App Store. With XCode 4.3 this is now a lot easier to do that before.

    Second, make sure all your variables that need properties and typedefs have those. This was the problem with my app. I was passing around a block variable from one view controller to another, then inside the second view controller. In the interface section of my header file I had:

    Code:
    void (^DoneCallback)(NSString *file);
    But what i needed was this outside the interface:

    Code:
    typedef void (^DoneCallback)(NSString *file);
    
    @property (nonatomic, copy) DoneCallback doneCallback;
    Then afterwards in the .m I could set the block variable as such:

    Code:
     self.doneCallback = callback;
    And call it in another method like:

    Code:
     self.doneCallback(file);
     

Share This Page