11

I'm trying to add "Custom.framework" to my pod (cocoapods). And I'm a bit stuck with pod spec setup. I've done following:


s.resources = ['Resources/Custom.framework']
s.preserve_paths = "Resources/Custom.framework"
s.frameworks  = "UIKit", "Custom"

But in project where I'm using this pod, I'm getting error

<Custom/Custom.h> not found

or something similar.

I'm stuck already for a few hours and I can't find answer to my question in google.

BR, Pavlo.

2 Answers 2

11

What you want is the vendored_frameworks attribute. In your case it looks like you'd want to use it like this:

s.vendored_frameworks = 'Resources/Custom.framework'

This automatically deals with preserving the path and linking the framework itself so you don't need either of those attributes for your custom framework.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried putting my framework inside a Resources folder, where the podspec file is, and then included this line in the podspec: s.vendored_frameworks = 'Resources/Custom.framework'. However, that did not work. What DID work for me, was placing my Custom.framework in the same place as the podspec file is, and then inserted this line in the podspec instead: s.vendored_frameworks = 'Custom.framework' . After 'pod install' (don't forget this part), a new group called 'Frameworks' was generated automatically under my pod directory, and I had no more header file missing errors from the framework.
1

Using vendored_frameworks did the inclusion as @Keith said. But the addition to his answer is that I added the custom framework as a 'Do Not Embed' option. and the pod was able to link it and provide it to the using Application.

How the framework is embedded

You can also provide more frameworks. The following line includes Custom. framework nad Custom2.framework frameworks and any Xcode framework .xcframework

s.vendored_frameworks = 'YourOwnFrameworksFolder/Custom.framework' , 'YourOwnFrameworksFolder/Custom2.framework', 'YourOwnFrameworksFolder/**.xcframework'

Also, if your Custom.framework needs another framework to work successfully, I think you will need to provide it also in the vendored_frameworks but you don't need to embed it in your pod framework project as the pod project itself does not use it directly.

So for example, if Custom.framework needs CustomDependency.framework, the vendored_frameworks will be :

s.vendored_frameworks = 'YourOwnFrameworksFolder/Custom.framework' , 'YourOwnFrameworksFolder/CustomDependency.framework'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.