Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

WatchKit is not available when building for iOS Simulator.

Then I deleted WatchKit from iOS app target as suggested. Since then I am having this error:

Undefined symbols for architecture 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)

Undefined symbol: _OBJC_CLASS_$_WKInterfaceController

PS: The x86_64 part is dependent on the device/simulator choice. If I choose a real device it gives the same error for 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.

PS_2: There is no use of WKInterfaceController or even WatchKit in the iOS app. It is only used in WatchAppExtension part

What I have tried so far:

  • First thing was to add WatchKit framework to WatchApp and WatchAppExtension targets.
  • When I searched for Undefined symbols for architecture x86_64 type of errors in general there were many different suggestions. 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.
  • Checked the target of .m files. They are all fine.
  • I even went far and commented all the code that is using 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.
  • I checked the WatchKit.framework Device Supporting Files with file WatchKit.framework command and saw that it supports arm64. Then added that library manually to libraries, ran on device but still didn't work.
like image 611
iRestMyCaseYourHonor Avatar asked Feb 04 '23 17:02

iRestMyCaseYourHonor


2 Answers

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.

like image 180
Tim Sylvester Avatar answered Feb 06 '23 08:02

Tim Sylvester


Please check "Link Binary With Libraries" in "Build Phases". Is there any library that used still WKInterfaceController or is dependent on the WatchKit?

like image 41
user11630362 Avatar answered Feb 06 '23 07:02

user11630362