0

UISwipeGestureRecognizer在 Swift 中创建了对象。下面一行没有编译错误/警告。清理和构建应用程序完美。

let rightSwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, 
                                  action: "handleGesture:")
                                  ^^^^^ Error Part ^^^^^

但它在运行时给出了一个例外。

dyld: lazy symbol binding failed: Symbol not found: __TFSS37_convertFromBuiltinUTF16StringLiteralfMSSFTBp17numberOfCodeUnitsBw_SS
Referenced from:<AppPath>.app/AppName
Expected in: <AppPath>.app/Frameworks/libswiftCore.dylib

<AppPath>是模拟器的应用程序路径。

操作系统:Mac OS X 优胜美地 10.10

Xcode 版本:Xcode 6.0.1 (6A317)

我尝试过的;

我能够弄清楚这个问题与action: "handleGesture:"部分有关。所以我猜这里没有使用正确的选择器。

我试过Selector但没有完成。

  1. NSSelectorFromString("handleGesture:")
  2. Selector("handleGesture:")
  3. Selector.convertFromStringLiteral("handleGesture:")

编辑:

相同的行/代码适用于其他应用程序。我无法弄清楚为什么它停止从这一行执行,因为相同的代码适用于其他应用程序。

4

1 回答 1

1

试试这个它对我有用

var swipeEdit:UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: Selector("selector:"))
swipeEdit.direction = UISwipeGestureRecognizerDirection.Left;
element.addGestureRecognizer(swipeEdit);

有关更多详细信息,请通过堆栈溢出中的线程

dyld:找不到符号:错误如何解决此问题

于 2014-12-01T07:57:46.220 回答