触摸检测在iOS 9模拟器上不起作用 [英] Touch detection doesn't work on simulator for iOS 9
问题描述
我已将Xcode更新为Xcode7.然后将我的Swift项目更新为Swift2.最后,我删除了所有警告.
I've updated Xcode to Xcode 7. Then my Swift project to Swift 2. At last I removed removed all warnings.
第一个场景显示几个SKLabel
和几个SKSpriteNode
.
First scene display few SKLabel
and few SKSpriteNode
.
使用iOS模拟器,触摸检测在iOS 9上不起作用,但在iOS 8上可以.在touchesBegan
方法上设置的断点表明未调用此方法.
Using iOS Simulator, touch detection doesn't work under iOS 9 but is ok on iOS 8. A breakpoint put ontouchesBegan
method show this method is not called.
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
// Breakpoint is set here
}
编辑
删除这些消息并不能解决任何问题.
EDIT
Removing these messages does not solve anything.
仅在iOS 9上,出现警告后控制台显示4次:
Console display following warning 4 times, on iOS 9 only:
Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found. Did find:
/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7ba430f0 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
推荐答案
好,问题解决了!
在StoryBoard上,初始视图控制器主View
上的userInteractionEnabled
属性设置为"NO".将其更改为是"即可解决问题.
On StoryBoard, userInteractionEnabled
property on the main View
of the initial view controller was set to "NO". Changed it to "YES" solve the problem.
这很奇怪,因为在iOS 8上一切正常.
This is weird because everything worked fine on iOS 8.
这篇关于触摸检测在iOS 9模拟器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!