简体   繁体   English

未定义符号:将 Xcode 更新到版本 11.1 后出现 _OBJC_CLASS_$_WKInterfaceController 错误

[英]Undefined symbol: _OBJC_CLASS_$_WKInterfaceController error after updating Xcode to version 11.1

I updated Xcode to version 11.1 and got this expected error:我将 Xcode 更新到版本 11.1 并得到了这个预期的错误:

WatchKit is not available when building for iOS Simulator.为 iOS 模拟器构建时,WatchKit 不可用。

Then I deleted WatchKit from iOS app target as suggested.然后我按照建议从 iOS 应用程序目标中删除了 WatchKit。 Since then I am having this error:从那以后我遇到了这个错误:

Undefined symbols for architecture x86_64:架构 x86_64 的未定义符号:
"_OBJC_CLASS_$_WKInterfaceController", referenced from: objc-class-ref in INFOnlineLibrary(IOLWatchKitHelper.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) “_OBJC_CLASS_$_WKInterfaceController”,引用自:INFOnlineLibrary(IOLWatchKitHelper.o) 中的 objc-class-ref:未找到架构 x86_64 clang 的符号:错误:Z3175B426046787EECE7377387310B98 调用失败,代码为 exit )

Undefined symbol: _OBJC_CLASS_$_WKInterfaceController未定义符号:_OBJC_CLASS_$_WKInterfaceController

PS: The x86_64 part is dependent on the device/simulator choice. PS:x86_64 部分取决于设备/模拟器的选择。 If I choose a real device it gives the same error for arm64.如果我选择一个真实的设备,它会为 arm64 给出相同的错误。 So I don't think it is a architecture issue also because of the fact that the framework that includes WKInterfaceController is just a standart watchOS framework which is Watchkit.所以我不认为这是一个架构问题,因为包含 WKInterfaceController 的框架只是一个标准的 watchOS 框架,即 Watchkit。

PS_2: There is no use of WKInterfaceController or even WatchKit in the iOS app. PS_2:在 iOS 应用程序中没有使用 WKInterfaceController 甚至 WatchKit。 It is only used in WatchAppExtension part它仅用于 WatchAppExtension 部分

What I have tried so far:到目前为止我已经尝试过:

  • First thing was to add WatchKit framework to WatchApp and WatchAppExtension targets.首先是将 WatchKit 框架添加到 WatchApp 和 WatchAppExtension 目标。
  • When I searched for Undefined symbols for architecture x86_64 type of errors in general there were many different suggestions.当我为架构 x86_64 类型的错误搜索未定义符号时,通常有许多不同的建议。 Even though I think it is not architecture dependent thing, I tried setting building active architecture only no in all targets.尽管我认为它不依赖于架构,但我尝试在所有目标中设置仅构建活动架构。 The most suggested putting $(inherited) to the search paths was already done before.最建议将 $(inherited) 放入搜索路径之前已经完成。
  • Checked the target of.m files.检查.m 文件的目标。 They are all fine.他们都很好。
  • I even went far and commented all the code that is using WKInterfaceController.我什至还评论了所有使用 WKInterfaceController 的代码。 Nothing has changed after.之后什么都没有改变。 I also deleted watch app, it still looked for _OBJC_CLASS_$_WKInterfaceController but I am not sure did it properly.我还删除了手表应用程序,它仍然在寻找 _OBJC_CLASS_$_WKInterfaceController 但我不确定它是否正确。
  • I checked the WatchKit.framework Device Supporting Files with file WatchKit.framework command and saw that it supports arm64.我使用file WatchKit.framework命令检查了 WatchKit.framework 设备支持文件,发现它支持 arm64。 Then added that library manually to libraries, ran on device but still didn't work.然后将该库手动添加到库中,在设备上运行但仍然无法正常工作。

Please check "Link Binary With Libraries" in "Build Phaes".请检查“Build Phaes”中的“Link Binary With Libraries”。 Is there any library that used still WKInterfaceController or is dependent on the Watchkit?是否有任何库仍然使用 WKInterfaceController 或依赖于 Watchkit?

I was getting the same error though with another framework.尽管使用另一个框架,但我遇到了同样的错误。 You just have to make sure that error files have the required framework is in your Link Binary with Libraries .您只需确保错误文件具有所需的框架在您的Link Binary with Libraries中。

In my case I had the error Undefined symbol: OBJC_CLASS $_SKStoreProductViewController which is related to StoreKit .在我的情况下,我遇到了与StoreKit相关的错误Undefined symbol: OBJC_CLASS $_SKStoreProductViewController All I had to do was add the StoreKit.framework into Link Binary with Libraries我所要做的就是将 StoreKit.framework 添加到Link Binary with Libraries

I faced a similar error, but in my case it was probably some unclean library lying around after adding / removing dependencies.我遇到了类似的错误,但在我的情况下,添加/删除依赖项后可能是一些不干净的库。 So I did Xcode -> Product -> Clean Build Folder , and rebuilt the project.所以我做了Xcode -> Product -> Clean Build Folder ,并重建了项目。 It succeeded.它成功了。

When I saw this error, it turned out to be because one of my .mm implementation files was not checked in the "Target Membership" section of the options pane, and so was not being built.当我看到这个错误时,原来是因为我的一个.mm实现文件没有在选项窗格的“目标成员”部分中检查,因此没有构建。

I had to drag & drop the framework into Xcode, under the Frameworks group.我必须将框架拖放到框架组下的 Xcode 中。 It was already added under Target > Build Phases > Embedded Frameworks, but apparently that wasn't enough.它已经在 Target > Build Phases > Embedded Frameworks 下添加,但显然这还不够。

If you are sure that implementation files are checked in the "Target Membership" section of your app for the build, make sure that there is an implementation of the header file somewhere.如果您确定在应用程序的“目标成员资格”部分中检查了实现文件以进行构建,请确保在某处存在 header 文件的实现。 I ran across this issue when I had a class that I had defined within the same file as another class and forgot to put its implementation in the related .m file for both classes.当我有一个 class 时遇到了这个问题,我在同一个文件中定义了另一个 class 并忘记将其实现放在两个类的相关.m文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xcode 发布构建问题未定义符号:_OBJC_CLASS_$_FIRAuth - Xcode release build problem Undefined symbol: _OBJC_CLASS_$_FIRAuth 为Xcode项目创建单元测试会导致错误:显示最近的消息:-1:未定义的符号:_OBJC_CLASS _ $ _ FBSDKCodelessIndexer - Creating unit tests for Xcode project results in error : Showing Recent Messages :-1: Undefined symbol: _OBJC_CLASS_$_FBSDKCodelessIndexer 集成 DocuSignSDK 时出错 - 未定义符号:_OBJC_CLASS_$_* - Error while integrating DocuSignSDK - Undefined Symbol: _OBJC_CLASS_$_* 未定义符号“_OBJC_CLASS_$_CkoFtp2”链接错误与chilikat - Undefined symbol "_OBJC_CLASS_$_CkoFtp2" link error with chilikat 未定义符号:_OBJC_CLASS_$_SKOverlayAppConfiguration - Undefined symbol: _OBJC_CLASS_$_SKOverlayAppConfiguration 未定义符号:_OBJC_CLASS_$_FIRAnalytics - Undefined symbol: _OBJC_CLASS_$_FIRAnalytics 未定义符号:_OBJC_CLASS_$_AppsFlyerLib - Undefined symbol: _OBJC_CLASS_$_AppsFlyerLib 未定义符号:_OBJC_CLASS_$_FBSDKBasicUtility - Undefined symbol: _OBJC_CLASS_$_FBSDKBasicUtility 未定义符号:_OBJC_CLASS_$_SFSDKLogger && _OBJC_METACLASS_$_SFSDKLogger - Undefined symbol: _OBJC_CLASS_$_SFSDKLogger && _OBJC_METACLASS_$_SFSDKLogger 未定义的符号:“_ OBJC_CLASS_ $ error - Undefined symbols: "_OBJC_CLASS_$ error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM