react-native-intercom 抛出神秘错误 - 未定义的体系结构符号 x86_64

react-native-intercom throws cryptic error - Undefined symbols for architecture x86_64

我正在使用 react-native-intercom 插件以及使用手动链接的最新对讲 ios 库。

该项目在链接阶段之前构建良好,然后抛出此错误。

我已经完成了对讲机手动链接过程中描述的所有步骤,包括在构建设置中将 strip 框架脚本添加为 运行 脚本阶段。

这是它抛出的错误信息。

undef: _OBJC_CLASS_$_ICMCompany
undef: _OBJC_CLASS_$_ICMUserAttributes
undef: _IntercomUnreadConversationCountDidChangeNotification
undef: _OBJC_CLASS_$_Intercom
Undefined symbols for architecture x86_64:
   "_OBJC_CLASS_$_ICMCompany", referenced from:
  objc-class-ref in libRNIntercom.a(IntercomUserAttributesBuilder.o)
  "_OBJC_CLASS_$_ICMUserAttributes", referenced from:
  objc-class-ref in libRNIntercom.a(IntercomUserAttributesBuilder.o)
  "_IntercomUnreadConversationCountDidChangeNotification", referenced 
from:
  ___48-[IntercomEventEmitter handleUpdateUnreadCount:]_block_invoke in libRNIntercom.a(IntercomEventEmitter.o)
  -[IntercomEventEmitter constantsToExport] in libRNIntercom.a(IntercomEventEmitter.o)
  -[IntercomEventEmitter supportedEvents] in libRNIntercom.a(IntercomEventEmitter.o)
  -[IntercomEventEmitter startObserving] in libRNIntercom.a(IntercomEventEmitter.o)
 "_OBJC_CLASS_$_Intercom", referenced from:
  objc-class-ref in AppDelegate.o
 (maybe you meant: _OBJC_CLASS_$_IntercomUserAttributesBuilder, 
 _OBJC_CLASS_$_IntercomWrapper , _OBJC_CLASS_$_IntercomEventEmitter )
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see 
 invocation)

我认为它与项目支持的框架架构有关,但我是 iOS 构建的新手,不知道如何解决这个问题。

Intercom installation期间有一个步骤要添加"Run Script Phase":

bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Intercom.framework/strip-frameworks.sh"

您需要确保此阶段确实在执行。

尝试使用无效路径,例如/Intercom.framework/foo/strip-frameworks.sh,如果构建过程没有因上述更改而出错,则说明其他地方存在问题,您需要确保已正确执行其他安装步骤。

只要此脚本运行,它就会正确剥离框架。

我也花了一段时间,但我能够以这种方式调试它并最终让它与 12.3.0 一起工作。