What does your app do when a user encounters an error?

Discussion in 'iOS Programming' started by moonman239, Sep 27, 2013.

  1. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    Let's say that something caused an error in your app. Either an error that went unnoticed before it was deployed in the App Store, or an error generated by an external service your app relies on. How does your app handle it?

    I think the ideal situation would be to inform the user that an error occurred and notify you, the developer, either by e-mail or by uploading the error message to a Web server to which you have access.
     
  2. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #2
    Unexpected errors are, er, unexpected. As a result, you don't see them coming, and usually your app simply crashes. When the app crashes you don't have any facility to notify the user. "I just died. Would you mind calling 911 and reporting my death? I apparently had a cerebral hemorrhage"

    You can use exception handling in some cases to catch errors, but it's better to do through input validation when writing your code, plus extensive testing and QA before release.
     
  3. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #3
    Is there any way for the app to check on launch to see if it crashed before? After all, I'm sure the user would like to see a message on relaunch saying, "We're sorry that the app crashed. Please know that our developer(s) will be notified immediately." Then the app would send the developer(s) a log that would help them figure out what went wrong.
     
  4. xArtx macrumors 6502a

    Joined:
    Mar 30, 2012
    #4
    Yes, if you have some process you aren't confident about you could write a key at the beginning,
    and another value to the same key when the process ended.
    That way if you launch the app and the key is not set by the previous routine,
    the app crashed during that process.
    One process could be your entire app run cycle.

    I do the same thing to check for first launch.
    The "firstlaunch" key doesn't exist at first launch,
    then I write a key with value of 1, and it stays that way.
     
  5. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #5
    Ok. It would kind of be nice if the SDK provided some sort of method that would be called if the app crashed. One that would allow me to program the app to send a message with as many details as iOS could provide to help me figure out the cause of the crash. After all, developers can only do so much pre-release testing and fixing. They can't be 100% certain it won't crash on a user's device.
     
  6. xArtx macrumors 6502a

    Joined:
    Mar 30, 2012
    #6
    Isn't that what the crash reporter thing does in iTC if the user agreed
    to send information? .. although I hear it doesn't work.
     
  7. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #7
    There seem to be several companies that sell crash logging and reporting libraries for iOS apps to use. Just plug one in instead if reinventing the wheel.
     
  8. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008

Share This Page