Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Framework containing pods into another project

I am facing a problem and searched for it a lot but did not found any solution.

I had created a Swift framework that uses MQTTKit" that I added to my Framework using CocoaPods.

Now I had created a sample app that will use the above framework.

Then I created a workspace and added the xcodeproj file of framework as well as sample app to the workspace.

But now I am not able to use that framework in my sample app.

I am getting the error No such module MQTTKit inside my framework.

However there is no error in the framework if I build it separately?

So is there is any problem with the pods or something else?

like image 259
Akshay Agrawal Avatar asked Jan 05 '16 11:01

Akshay Agrawal


People also ask

How do I add pods dependencies?

You can add dependencies on subspecs. Specify the minimum deployment target version for the Pod library. Re-import the project.


1 Answers

If you're using multiple Xcode Projects in a single Workspace, you should use pod targets like this:

platform :ios, '9.0'
inhibit_all_warnings!
use_frameworks!

target "MyApp" do
  xcodeproj 'MyApp'
  pod 'MQTTKit'

  target "SampleApp" do
    xcodeproj 'SampleApp'
    inherit! :search_paths
    pod 'MQTTKit'
  end
end

To learn more, refer to Cocoapods Podfile Syntax Reference

like image 119
RodolfoAntonici Avatar answered Oct 21 '22 22:10

RodolfoAntonici