Reputation: 21
Just added a WatchKit target to an existing Xcode project. Boom! 13 errors without typing a single new line of code. The first error listed is "No type or protocol named 'UIApplicationDelegate'".
I was able to create a fresh project and add the WatchKit target without any problems. That makes me think I need to adjust my existing project in some way.
Xcode 8 Beta is fairly new obviously but has anyone had this issue and overcome it?
Tried a couple things like explicitly importing UIApplication and even adding "-fgnu-inline-asm" to the Other C Flags build setting.
If I remove just the one target that gets added (not the extension one) and leave the new classes that were produced, the errors go away.
For enquiring minds, the error I mentioned was in the AppDelegate. Almost all of the other errors were of the "Unknown type" variety. Seems like the compiler loses its mind about where some basic classes like UIView, UIWindow, etc., are.
Upvotes: 2
Views: 2364
Reputation: 333
I encountered this error as well after adding a shared class that was shared between the iOS target and the Watch Extension target. In the shared class I was importing the AppDelegate.h file, so the watch extension target was trying to compile it. Removing the import solved the issue for me.
Upvotes: 2