[iOS] How to simulate static quick actions on xcode 7

October 16, 2015


Recenlty, Apple has just release iPhone 6s and iPhone 6s plus, with a amazing feature called 3D force touch. And this is a really interesting challenge for iOS developers to make the world better.

But sadly, with offical announcement from Apple, xcode 7 does not supported 3d force touch on Simulator.

With Xcode 7.0 you must develop on a device that supports 3D Touch. Simulator in Xcode 7.0 does not support 3D Touch.

That means, there is always a way to develope this cool feature by using a real device iphone 6s or 6s plus. But, still a other way, that save poor developers like me (haha). Let’s work with SBShortcutMenuSimulator


Firstly, you can clone this lib into your computer (or simply download it), and create the Makefile, all these steps should be worked on Terminal:

git clone https://github.com/DeskConnect/SBShortcutMenuSimulator.git
cd SBShortcutMenuSimulator

Then, we need to insert SBShortcutMenuSimulator.dylib into the simulator, let it can be supported by this lib.

xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment 		DYLD_INSERT_LIBRARIES=$PWD/SBShortcutMenuSimulator.dylib

and reboot the simulator:

xcrun simctl spawn booted launchctl stop com.apple.SpringBoard

Last one, to run it, send the app’s bundle identifier over TCP to port 8000.

In iphone 6s and 6s plus simulator, they already have some default apps that are supported 3d force touch, here is the list of bundle ids of them:

	Camera:       com.apple.camera
	AppStore:     com.apple.AppStore
	Contacts:     com.apple.MobileAddressBook
	Mail:         com.apple.mobilemail
	GameCenter:   com.apple.gamecenter
	MobileSafari: com.apple.mobilesafari
	Preferences:  com.apple.Preferences
	iPod:         com.apple.mobileipod
	Photos:       com.apple.mobileslideshow
	Calendar:     com.apple.mobilecal
	Clock:        com.apple.timer
	Apple Maps:  com.apple.Maps
	Notes:       com.apple.mobilenotes
	Reminders:   com.apple.reminders
	Videos:      com.apple.videos
	Passbook:    com.apple.Passbook
	Calculator:  com.apple.calculator
	Music:       com.apple.Music

For example, running calendar shortcut we could use:

echo 'com.apple.mobilecal' | nc 8000

and a merical is shown.

  • Notice: If a app has already built on simulator, we need to remove it and rebuild, also reset the simulator by xcrun simctl spawn booted launchctl stop com.apple.SpringBoard. (this happened to me once, waste my hours)

Build my own app with Quick Action

In the Info.plist file view as Source Code, we insert this xml text demo:

            <string>Test 1</string>
            <string>Test 2</string>

If you turn Info.plist file as Property list it must be this:

  • Above is just the basic steps to create. If you want more details, you also can check this that I have used and had a high rating for that tutorial.

Rebuild the app, to make sure you need to remove it from simulator and rebuild, we don’t need to do this afterward.

And run it with current Bundle Id on Terminal:

echo 'TraDa.QuickActionsDemo' | nc 8000


So hope this could help you guys who read this a bit about how to simulate 3d force touch, and indeed want to give a big Thanks to DeskConnect team, you guys are amazing.

Any question and discussion, just leave as comments. I’m really glad to receive.

Happy coding.