Xcode 6 GM版,iPhone 6模拟器,'UITapGestureRecognizer'没有可见的@interface声明选择器'initWithTarget:action:'

Car*_*loS 11 xcode ios xcode6

UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognized:)];
Run Code Online (Sandbox Code Playgroud)

这段代码可以为Xcode 5中的任何模拟器编译,

但在Xcode 6中,它只能编译32位CPU(iPhone 5及以下)的模拟器,

在编译64位CPU(iPhone 5s,iPhone 6,iPhone plus)的模拟器时,编译器说:

'UITapGestureRecognizer'没有可见的@interface声明选择器'initWithTarget:action:'

但我确实已经进口了 <UIKit/UITapGestureRecognizer>

有什么问题?

rin*_*aro 22

首先尝试Product> Clean菜单.(即command+ shift+ k)
如果没有帮助,请使用option键,Product> Clean Build Folder...(即option+ command+ shift+ k).
最后,删除所有派生数据目录rm -rf ~/Library/Developer/Xcode/DerivedData/.

我认为~/Library/Developer/Xcode/DerivedData/ModuleCache/*使用旧的(Xcode5)SDK会导致此问题.