APP Crashed Error

An app crash means the application stopped unexpectedly because of an unhandled error, exception, memory issue, or system failure.

Common crash reasons

Mobile Apps (iOS/Android)

  • Null pointer / nil object access
  • Array index out of bounds
  • Memory overflow
  • UI updates on background thread
  • API response parsing failure
  • Force unwrap crash
  • Missing permissions
  • Infinite loops
  • Third-party SDK crash

iOS App Crash (Objective-C / Swift)

Common iOS crash examples

  1. Array out of bounds

objectivec id=”m7q2we”
NSArray *arr = @[@”A”];
NSLog(@”%@”, arr[5]);

Crash:

text id=”v4k8ra”
*** Terminating app due to uncaught exception

Fix

objectivec id=”n3p1xd”
if (index < arr.count) {
NSLog(@”%@”, arr[index]);
}

  1. Nil or invalid object

objectivec id=”u8w5kc”
NSDictionary *dict = nil;
NSLog(@”%@”, dict[@”name”]);

  1. Main thread UI issue

objectivec id=”g7q2mv”
dispatch_async(dispatch_get_global_queue(0,0), ^{
self.label.text = @”Updated”;
});

Fix

objectivec id=”r4k9zn”
dispatch_async(dispatch_get_main_queue(), ^{
self.label.text = @”Updated”;
});

Android Crash Examples

NullPointerException

java id=”t2p5xe”
String name = null;
name.length();

Fix

java id=”q6m3yt”
if(name != null){
name.length();
}

Web App Crash Causes

  • JavaScript exceptions
  • Infinite rendering loops
  • Memory leaks
  • API failures
  • CORS issues
  • Unhandled promises

How to debug crashes

iOS

Use:

Use:

  • Android Studio Logcat
  • Firebase Crashlytics
  • Stack traces Web

Use:

  • Browser DevTools
  • Console logs
  • Network tab
  • Error monitoring

Typical crash log example

text id=”w9k1vc”
Fatal Exception: java.lang.NullPointerException

or

text id=”p4q7ra”
SIGABRT

Most important step

Look at:

  • stack trace,
  • exception name,
  • line number,
  • method causing crash.

That identifies the exact issue.

Common crash types

| Crash Type | Meaning |
| — | – |
| SIGABRT | Forced termination |
| SIGSEGV | Invalid memory access |
| NullPointerException | Object is null |
| EXC_BAD_ACCESS | Invalid iOS memory access |
| OutOfMemoryError | Memory exhausted |