最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to crash react native app on purpose? - Stack Overflow

programmeradmin2浏览0评论

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

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

Share Improve this question asked Apr 9, 2019 at 13:22 zsubzwaryzsubzwary 1,2462 gold badges15 silver badges23 bronze badges 3
  • what about making any null pointer exception or division by zero ? Does not that work? – Gonzalo.- Commented Apr 9, 2019 at 13:24
  • 5 while(1) works every time – Jeremy Thille Commented Apr 9, 2019 at 13:25
  • 1 or just console.log(a); Crash : a is undefined. – Jeremy Thille Commented Apr 9, 2019 at 13:26
Add a comment  | 

4 Answers 4

Reset to default 8

TypeScript

  const test: any = {};
  console.log(test.should.crash);

Will cause

TypeError: undefined is not an object (evaluating 'test.should.crash')

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

i.e.

<View>hello world</View>

Consider that you can't crash app on development. these answers cause crash on production releases only

You can crash the app by requesting Camera without adding the key NSCameraUsageDescription in Info.plist. It'll crash the app without warning.

发布评论

评论列表(0)

  1. 暂无评论