Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple projects and Cocoapods

I want to have a Workspace that contains two projects (2 different apps), a Common (shared) project and a couple of Pods.

I have been struggling to get the App1 project to "see" the Common classes.

My thinking was:

  1. Create the workspace
  2. Create the two app projects (App1 and App2)
  3. Create the Common project
  4. Create Podfile

The Podfile I have is along the lines of this:

workspace 'MyApps'
xcodeproj 'App1/App1.xcodeproj'
xcodeproj 'App2/App2.xcodeproj'
xcodeproj 'Common/Common.xcodeproj'

target :App1 do
    platform :ios, '6.0'
    pod 'AFNetworking', '~> 1.3.2'
    xcodeproj 'App1/App1.xcodeproj'
end

target :App2 do
    platform :ios, '6.0'
    pod 'AFNetworking', '~> 1.3.2'
    xcodeproj 'App2/App2.xcodeproj'
end

target :Common do
    platform :ios, '6.0'
    pod 'AFNetworking', '~> 1.3.2'
    xcodeproj 'Common/Common.xcodeproj'
end

I have seen this question but I can't seem to get the Common code to be available in the Apps.

Do I have to manually update the search paths for each of the Apps projects to make it work or can this be solved via the Podfile?

like image 838
nicktmro Avatar asked Sep 12 '13 02:09

nicktmro


1 Answers

i had a similar problem at work, and i found it was better to change the project structure to work with Cocoapods.

i think the right solution for you, or at least the right path to one, is to turn your common project into a local (see "Using the files from a local path" here), private pod.

i implemented my common project as such, and have my Application project also configured with CocoaPods, using that private pod.

a final word of note, when building a common library project through CocoaPods, you'll want to override the 'Other Linker Flags' build setting in that project, just like it is in the Pods project created and managed by CocoaPods.

¡let me know if this works for you!

like image 87
calql8edkos Avatar answered Oct 14 '22 03:10

calql8edkos