SPACEX – ISS Docking Simulator

This simulator will familiarize you with the controls of the actual interface used by NASA Astronauts to manually pilot the SpaceX Dragon 2 vehicle to the International Space Station. Successful docking is achieved when all green numbers in the center of the interface are below 0.2. Movement in space is slow and requires patience & precision.

My inner space-geek rejoices! 🤓

SPACEX – ISS Docking Simulator →

Take charge of the iOS/tvOS/watchOS simulators with Control Room

Nice tool by Paul Hudson:

Control Room is a macOS app that lets you control the simulators for iOS, tvOS, and watchOS – their UI appearance, status bar configuration, and more. It wraps Apple’s own simctl command-line tool, so you’ll need Xcode installed.

Some features, such as sending example push notifications or move between light and dark mode, require Xcode 11.4 or later.

Control Room →

A/B Street – A traffic simulator written in Rust

Ever been on a bus stuck in traffic, wondering why there are cars parked on the road instead of a bus lane? A/B Street is a game exploring how small changes to a city affect the movement of drivers, cyclists, transit users, and pedestrians.

I should send this to my local government, as they keep changing street directions and what not based on hunches by the looks of it 😅

A/B Street →

Via Frederick

React-Native “Could not find iPhone X simulator”

One of my React Native projects recently decided to no longer launch any of the iPhone Simulator devices anymore. When running react-native run-ios I was greeted with an error stating that the simulator could not be found.

bramus in ~/repos/projects/react-native-maps-directions-example on master*
$ react-native run-ios --simulator="iPhone X"
Found Xcode project RNMapsExample.xcodeproj

Could not find iPhone X simulator

Error: Could not find iPhone X simulator
    at Promise.then.udid.udid (/Users/bramus/repos/projects/react-native-maps-directions-example/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
    at new Promise (<anonymous>)
    at runOnSimulator (/Users/bramus/repos/projects/react-native-maps-directions-example/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/bramus/repos/projects/react-native-maps-directions-example/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at /Users/bramus/repos/projects/react-native-maps-directions-example/node_modules/react-native/local-cli/cliEntry.js:117:22

error Command failed with exit code 1.

No matter which simulator I targeted, the error always remained …

💁‍♂️ To list all available simulators, which you can pass into –simulator, run this command:

$ xcrun simctl list

The cause

The issue occurs for older RN versions (0.57, 0.58 (<0.58.4), …) with Xcode 10.3, where the names of the available simulators got somewhat tweaked. In the file node_modules/@react-native-community/cli/build/commands/runIOS/findMatchingSimulator.js, React Native tries to select the proper Simulator with a simple .startsWith check. Due to the rename, the check should now use .includes (ref).

The fix

React 0.58.4 and up do not have this problem. If you can upgrade to React Native 0.58.4 or newer, then do.

If you cannot or wont upgrade to a newer RN version, then you can automate the adjustment in the findMatchingSimulator.js file with this command:

sed -i '' 's/startsWith/includes/g' node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

Put it in a postinstall script in your package.json and your colleagues/CI will also automaticlaly pick it up:

"scripts": {
    "postinstall": "sed -i '' 's/startsWith/includes/g' node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js"
}

The postinstall script will be run right after yarn install did its thing, ensuring the fix is applied 🙂

Did this help you out? Like what you see?
Thank me with a coffee.

I don't do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

☕️ Buy me a Coffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.

XCode 9.0: Fixing a Slow/Unresponsive iOS Simulator

Whilst initially implementing react-native-maps into a project I noticed that the iOS Simulator didn’t quite like it. Whenever the Mapview was visible on the screen, the Simulator was maxing out on something.

Turns out the OpenGLES.framework that comes with XCode 9.0 – and not react-native-maps itself – is the culprit. That version is buggy and makes the iPhone Simulator have issues when rendering hardware accelerated content (3D, Mapkit, etc).

Awaiting the release of XCode 9.1 – which contains a new and fixed version – there’s a workaround which involves using the OpenGLES.framework that came bundled with XCode 9.0 beta 3 (which isn’t affected). Full instructions on how to get an use this version are available as a Gist on GitHub.

⚠️ Installing frameworks/binaries from unfamiliar/untrusted resources always involves some risk. I can only say that I’ve been using the linked version without any issues. Your mileage may vary. Use at your own risk.

Did this help you out? Like what you see?
Consider donating.

I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

☕️ Buy me a Coffee ($3)

Interacting with the iOS Simulator from the Command Line using simctl

Wasn’t aware of this, but turns out one can control (and interact with) the iOS Simulator straight from the command line.

There’s no need to install anything new though. The tool we’re going to be using is already on our Mac, hiding inside the xcrun command, which gets installed with Xcode.

It’s called simctl.

Here’s a few examples:

# open a URL
xcrun simctl openurl booted "https://littlebitesofcocoa.com"

# upload an image to the iOS Simulator
xcrun simctl addmedia booted ~/images/image1.png ~/images/image2.jpg

# Take a screenshot
xcrun simctl io booted screenshot ~/Desktop/screenshot.png

# Record a video
xcrun simctl io booted recordVideo --type=mp4 ~/Desktop/movie.mp4

Other commands include booting/stopping a device, clipboard operations, launching/terminating processes, installing/uninstalling apps, etc. — No touch events though, that would’ve been real fun.

Little bits of Cocoa: Interacting with the iOS Simulator using simctl

Sidenote: digging a bit deeper into this I stumbled upon fbsimctl. Their features are quite the same which makes me wonder if fbsimctl uses simctl underneath its hood, or if simctl came later and copied features from fbsimctl.

FBSimulatorControl – A Mac OS X library for managing and manipulating iOS Simulators

Just launched by Facebook: FBSimulatorControl, A Mac OS X library for managing, booting and interacting with multiple iOS Simulators simultaneously.

FBSimulatorControl works by linking with the private DVTFoundation, CoreSimulator and DVTiPhoneSimulatorRemoteClient frameworks that are present inside the Xcode bundle. Doing this allows FBSimulatorControl to talk directly to the same APIs that Xcode and simctl do. This, combined with launching the Simulator binaries directly, means that multiple Simulators can be launched simultaneously.

The original use-case for FBSimulatorControl was to boot Simulators to run End-to-End tests with WebDriverAgent.

FBSimulatorControl →

iPhone Simulator: The simulated application quit

Fresh OS X install, fresh XCode install, and starting the iPhone Simulator (without launching any custom app) quits at start-up and spits out a “The simulated application quit” error dialog.

Turns out the Asepsis feature from TotalFinder (the feature which prevents the creation of .DS_Store files) is the culprit. Disable that feature and all will work fine.

Xcode iPhone Simulator location

I keep on forgetting the location of iPhone Simulator.app (I know, you can access it from within XCode, but that’s not always running when developing a website). Placing it here not to forget it anymore (and to find it back via Google):

XCODE 4.3 and XCODE 5:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app

XCODE 4
/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app

Pro-tip, place a link in your Applications to the simulator using ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app /Applications/iPhone\ Simulator.app. That way the app will also be available from QuickSilver/Alfred 😉

Did this help you out? Like what you see?
Consider donating.

I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

☕️ Buy me a Coffee ($3)