Guy
Guy

Reputation: 13306

Reliable way to close an app on the iPhone Simulator while working with React Native

As this question points out hitting cmd+shift+H twice or hitting the home button twice should open the app carousel and swiping up should close an app.

Yet I found myself pressing it multiple times and the carousel only shows up about half of the times. Other times 5 consecutive presses brings it up. Sometimes it just goes to the home screen and only works if I go inside the app again and do it from there. I wonder, is there a reliable way to go about it except resorting to this voodoo? ;-)

I am working with react-native storybook if it holds any significance:

npm run storybook

I am working on iPhone 6 plus simulator so the iPhone X simulator swipe up is less of an option for me.

Upvotes: 2

Views: 472

Answers (1)

Guy
Guy

Reputation: 13306

From the terminal:

xcrun simctl terminate [device name] [bundle id]

For example:

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

or

Add to the package.json:

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

and run:

npm run close

Upvotes: 2

Related Questions