iRestMyCaseYourHonor
iRestMyCaseYourHonor

Reputation: 809

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:

Upvotes: 22

Views: 77915

Answers (7)

Muhammad Ali
Muhammad Ali

Reputation: 1151

Solution which worked for me is. My project is in Objective-c and i selected the .m file (which is giving error) and from File Inspector i checked the target. it works!

Upvotes: 0

Elijah
Elijah

Reputation: 2213

For me I added a Swift library to my react-native project and the post-install instructions were below manual linking. Just create an Empty folder with the target of your app and name the file Swift.

Upvotes: 0

Eli017
Eli017

Reputation: 91

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. 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.

Upvotes: 1

alekop
alekop

Reputation: 3026

I had to drag & drop the framework into Xcode, under the Frameworks group. It was already added under Target > Build Phases > Embedded Frameworks, but apparently that wasn't enough.

Upvotes: 1

Tim Sylvester
Tim Sylvester

Reputation: 23168

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.

Upvotes: 16

beria
beria

Reputation: 193

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. It succeeded.

Upvotes: 1

Gerard G
Gerard G

Reputation: 3463

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.

In my case I had the error Undefined symbol: OBJC_CLASS$_SKStoreProductViewController which is related to StoreKit. All I had to do was add the StoreKit.framework into Link Binary with Libraries

Upvotes: 2

Related Questions