Search code examples
swiftcocoapodsios8-extensionios8-today-widget

cocoapods in library not found in app extension


I have an app and accompanying extension, with a cocoa touch framework in the same project containing most of the shared code. The problem I'm faced with is that the cocoapods that the framework depends on are not found when compiling the app extension. The framework target compiles just fine, but when I compile the extension target I get a bunch of 'unresolved identifier' errors.

The problem does not seem to be that the framework is not being linked as I can access classes defined within it just fine from the extension. I have looked at other questions such as this one, but nothing I've seen seems to solve my problem.

Any help would be greatly appreciated!

EDIT:

The problem was solved by creating a separate bridging header for the extension. Hope this can help someone else!

EDIT 2:

Unfortunately this solution causes the warning

Class AFHTTPRequestOperation is implemented in both path/myFramework and
path/myWidget.appex/myWidget. One of the two will be used. Which one is undefined.

An explanation of why this happens and how to avoid it would by much appreciated.


Solution

  • Your extension needs its own bridging header. Add one, import the cocoapod, follow this answer if you need to here, go.