Friday, March 10, 2017

using 'vendored_frameworks' and 'source_files' for cocoapod using 'use_frameworks!'

Leave a Comment

I'm building a cocoapod that basically contains a framework (private sources) and a view (open source) that rely on this framework, all made in Objective-C.

In the podspec I have the following lines :

  • spec.vendored_frameworks = 'MyPod/Framework/MyFramework.framework'
  • spec.source_files = ['MyPod/UI/Views/MyView.{h,m}']

When using the use_frameworks! syntax, I can't #import MyFramework

I just don't understand what's happening.

Moreover, when I remove the spec.source_files line, I can #import MyFramework and it works perfectly, but of course I cannot use MyView.

What am I doing wrong ?

2 Answers

Answers 1

If you use use_frameworks! your pod itself will become a framework. Therefore you should #import MyPod instead of #import MyFramework and then use MyView.

Review also public_header_files in case you need it.

Answers 2

Since the project's pods are now a framework, you could try importing it as a module using @importMyFramework.

However, if that doesn't work, then try backing up your project and then running pod deintegrate && pod install. Also, this question is very similar, and some of its comments and answers may be helpful.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment