问题
The new 9.1 simulator with Xcode 7.1 has the feature to simulate a force touch like the iPhone 6s / 6s+ but the option is greyed / disabled.
iOS Simulator > Hardware > Force Touch Pressure [disabled] Screenshot for reference
Anybody know how to enable this option?.
Note: Im testing this on a iPhone 6s simulator
回答1:
Simulator does not support interaction with iOS Devices using 3D Touch prior to Xcode 7.3. The menu item that you are referencing relates only to Apple Watch devices.
回答2:
select simulator(watch) --> Hardware --> Force Touch Pressure --> Deep Press, and then click and hold on simulator, menu will be popup. you don't need to real device to test context menu.
回答3:
On the Apple Developer website, it says:
NOTE
With Xcode 7.1 you must develop on a device that supports 3D Touch. Simulator in Xcode 7.1 does not support 3D Touch.
Apparently, the new Simulator 9.1 does not support 3D Touch. You can actually implement such a behavior but (unfortunately) you have to test it on real a device that supports 3D Touch.
I guess we all have to wait for the next issue of Xcode.
See here for similar discussion and way to test force touch only for quick actions (on the app icon).
回答4:
It is true that by far (Xcode 10.1) iOS simulator still does not support 3D touch if your Mac doesn't have touchpad with this capability.
However, there are a few libraries like this that swizzle system's touch event handling and inject 3D touch feature. Of course, you don't want this code to be included in your production code to avoid being rejected on app's review, but you can certainly use this for development!
The library I mentioned works great for my Swift 4.1 project.
来源:https://stackoverflow.com/questions/33318329/how-to-enable-force-touch-pressure-on-ios-simulator-9-1