Home > other >  How to access class from main app in Widget Extension
How to access class from main app in Widget Extension

Time:12-03

I am having trouble accessing classes from the main app in my widget extension.

I have tried selecting widget in target membership of the class I want to access, but for some reason I get a lot of Undefined errors from widget. I want to share API classes and Models. The error occurs exactly when I share API classes, and not when I share models only. I have no idea what's wrong:(

enter image description here

CodePudding user response:

The errors is telling you that some part of the class you are using are including libraries that are written in C . To fix it:

  1. Select the widget target in the project area.
  2. Select the "Build Settings" tab.
  3. Type "linker" in the search box.
  4. Find the "Other Linker Flags".
  5. Double click on the right side of the "Other Linker Flags" row.
  6. Press " " and type "-lc "

See screen shot below:

enter image description here

  • Related