在使用React Native时在iPhone Simulator上关闭应用程序的可靠方法

时间:2018-06-26 21:30:28

标签: react-native ios-simulator

this question指出,按两次cmd + shift + H或按两次“主页”按钮应打开应用程序轮播,向上滑动则应关闭应用程序。

然而,我发现自己多次按下它,而轮播仅出现大约一半的时间。其他时间连续5次按下即可。有时,它只会进入主屏幕,并且只有当我再次进入该应用并从那里开始时才可以使用。我想知道,除了求助于这种伏都教之外,还有没有可靠的方法去做? ;-)

如果有任何意义,我正在与react-native storybook合作:

npm run storybook

我正在使用iPhone 6 plus模拟器,因此iPhone X模拟器向上滑动不是我的选择。

1 个答案:

答案 0 :(得分:1)

从终端:

xcrun simctl terminate [device name] [bundle id]

例如:

xcrun simctl terminate "iPhone 8 Plus" org.reactjs.native.example.layout"

添加到package.json:

"close": "xcrun simctl terminate \"iPhone 8 Plus\" org.reactjs.native.example.layout",

并运行:

npm run close