0

I am creating a widget in the today function and wish to reuse the classes from my container app. I include the ".h" file, however, even though everything complies, I get a linker error saying that the referenced class cannot be found. "Symbol(s) not found for architecture x86_64.

This seems strange to me.

Does this mean I have to put all my container classes in a specific library and then link to that library from both the container app and widget app?

Thanks

1 Answers1

1

I figured this out when experiencing the same problem. Basically the issue arrises because you are trying to use a class which you added to the target of your app. This is fine but you need to also add it to the Widget target, otherwise the Xcode linker will not link in that class code file and thus during compilation you will have an error because you are referencing a file that is not available to the widget.

In order to fix this issue follow these steps:

Click on your project in the left hand menu in your Xcode project and then select your widget target. Then add in the implementation class (.m) file too the "Compile Sources" section. Then rebuild and it should work fine.

enter image description here

I hope this helps :)

Supertecnoboff
  • 6,406
  • 11
  • 57
  • 98
  • Thanks so much for this. This helped me too. This is a vital thing to do, otherwise you will end up with lots of copies of the same code. –  May 07 '15 at 10:44
  • @Dan I was just experimenting in Xcode and figured this out. – Supertecnoboff May 08 '15 at 10:22