我知道已经有无数的Mach-O Linker错误帖子,并且我已经浏览了至少十二个试图找到解决我的问题的方法。许多解决方案评论说,我必须“选中该框”或检查编译源,以确保正确导入了我的.m文件,是的,我做到了所有这些。我已经在这里呆了几个小时,但似乎无法从以下错误中得到任何帮助:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_JSQMessage", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesAvatarImageFactory", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesBubbleImageFactory", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesTimestampFormatter", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQMessagesViewController", referenced from:
  _OBJC_CLASS_$_ChatView in ChatView.o
  "_OBJC_CLASS_$_JSQPhotoMediaItem", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_CLASS_$_JSQSystemSoundPlayer", referenced from:
  objc-class-ref in ChatView.o
  "_OBJC_METACLASS_$_JSQMessagesViewController", referenced from:
  _OBJC_METACLASS_$_ChatView in ChatView.o
  "_kJSQMessagesCollectionViewCellLabelHeightDefault", referenced from:
  -[ChatView collectionView:layout:heightForCellTopLabelAtIndexPath:] in ChatView.o
  -[ChatView collectionView:layout:heightForMessageBubbleTopLabelAtIndexPath:] in ChatView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

对于解决上述错误的任何帮助或建议,我们将不胜感激,并且最终将使我从这个棘手的障碍中继续前进。先感谢您!

最佳答案

通过Cocoapods使用此库时,我遇到了相同的错误。我在执行pod install时注意到了此警告消息:



我在项目的构 build 置中将$(inherited)添加到OTHER_LDFLAGS中,从而解决了该问题!

10-07 19:43
查看更多