4

I have an ObjC project and I've added a WatchApp Extension target in Swift. It works fine, however I have a database handler class that I wanted to make accessible from the watch extension target in order to get some data from it. I've added the database class in the Bridging Header file in the extension target but when I instantiate the class in the app viewController I get an error of missing symbol. I've trying adding the path to the class in the Header Search Path but it still doesn't work. Does anyone have any idea of what I'm missing?

Lucas Pereira
  • 569
  • 1
  • 11
  • 23

1 Answers1

6

You need to add the class to your WatchKit extension target. Alternately, you can build a framework with your shared code.

Edit

See this for more info Calling a Method on Watchkit

Community
  • 1
  • 1
Stephen Johnson
  • 5,293
  • 1
  • 23
  • 37
  • How do I add the class to the other target? I've included it's search header and added it to the Bridging Header. It event autocompletes the methods from the external class in the extension but it won't compile. – Lucas Pereira Mar 11 '15 at 20:42
  • 3
    Open the file you want to include and then open the right side pane (it is called the utilities pane.) Find the section called "Target Membership" and click on the checkbox next to your WatchKit extension. See the link in my response, it has a screen shot. – Stephen Johnson Mar 11 '15 at 20:48