8

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

zsubzwary
  • 1,196
  • 1
  • 14
  • 22

4 Answers4

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
2

just add any string outside of a <Text/> block

i.e.

<View>hello world</View>
Shep Sims
  • 698
  • 9
  • 27
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