更新至 XCode 8.3.1:带有 Snapkit 错误的 Apple Mach-O 链接器错误组

Update to XCode 8.3.1: Apple Mach-O Linker Error Group with Snapkit error

刚刚更新到 Xcode 8.3.1 并构建我的项目得到如下错误:

 "__TFE7SnapKitPS_23ConstraintAttributesDSLg6heightCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg5widthCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg6centerCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg7centerXCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg6bottomCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg7leadingCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg7centerYCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg8trailingCS_14ConstraintItem", referenced from:

  "__TFE7SnapKitPS_23ConstraintAttributesDSLg3topCS_14ConstraintItem", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

似乎是 SnapKit 的问题。

如果不是版本问题。如何debug/solve 这类错误。谢谢。

编辑 右键单击项目导航器中的错误,然后选择 Reveal in Log 显示更多错误信息:

Undefined symbols for architecture x86_64:
  "__TFE7SnapKitPS_23ConstraintAttributesDSLg6heightCS_14ConstraintItem", referenced from:
      __TFFC6Auroma22AURAlarmViewController19configureBottomViewFCSo6UIViewT_U2_FC7SnapKit15ConstraintMakerT_ in AlarmViewController.o

我可以看到 AlarmViewController 调用了 SnapKit 布局方法。但仍然不清楚为什么会出现错误。

编辑 我之前的Xcode应该是8.3.

最终通过删除 ~/Library/Developer/Xcode/DerivedData.

解决