I have already seen this one, but I don’t want extra packages on my hand
I have also tried to throw
exception but it was quite slow and created many other problems, all I want is a piece of code that just crashes the app
Asked
Active
Viewed 8,141 times
8

zsubzwary
- 1,196
- 1
- 14
- 22
-
what about making any null pointer exception or division by zero ? Does not that work? – Gonzalo.- Apr 09 '19 at 13:24
-
5`while(1)` works every time – Jeremy Thille Apr 09 '19 at 13:25
-
1or just `console.log(a);` Crash : `a is undefined`. – Jeremy Thille Apr 09 '19 at 13:26
4 Answers
8
TypeScript
const test: any = {};
console.log(test.should.crash);
Will cause
TypeError: undefined is not an object (evaluating 'test.should.crash')

Greg T
- 3,278
- 3
- 37
- 39
3
Consider that you can't crash app on development. these answers cause crash on production releases only

Parham Heidari
- 316
- 3
- 14
-
-
@ShepSims I don't work with react native now-days, at that moment it didn't crash on development. no idea about the latest version in case it's your meant. – Parham Heidari Jan 25 '23 at 16:13
0
You can crash the app by requesting Camera without adding the key NSCameraUsageDescription in Info.plist. It'll crash the app without warning.

Anh Nguyen
- 192
- 2
- 15