Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
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.
 

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
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.

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.
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
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.

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.
 

xArtx

macrumors 6502a
Mar 30, 2012
764
1
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.

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.
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
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.

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.
 

xArtx

macrumors 6502a
Mar 30, 2012
764
1
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.
 

firewood

macrumors G3
Jul 29, 2003
8,108
1,345
Silicon Valley
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.