Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of pods static library in user's project. #1

Closed
alloy opened this issue Sep 12, 2011 · 10 comments
Closed

Usage of pods static library in user's project. #1

alloy opened this issue Sep 12, 2011 · 10 comments

Comments

@alloy
Copy link
Member

alloy commented Sep 12, 2011

Currently the user still has to perform these steps:

  • Link against libraries that the pods library links against
  • Add header search paths that were added to the pods library

The user also has to perform these steps, but this might just be the simplest way that xcode allows:

  • Add pods static library to workspace
  • Configure project to Always Search User Paths and set User Header Search Paths to $(BUILT_PRODUCTS_DIR)

In addition, some changes to the pods static library project had to be made:

  • Change Public Headers Folder Path to $(TARGET_NAME)
  • Change Installation Directory to $(BUILT_PRODUCTS_DIR)

Most of this info was taken from: http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4

@alloy
Copy link
Member Author

alloy commented Sep 12, 2011

In order to make the app link the right libraries in the simplest way seems to be to generate an xcconfig file that the user's target configurations need to be based on. This also fixes the other extra settings needed in the user's app. I’ve added some code that generates xcconfig files like:

USER_HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)
ALWAYS_SEARCH_USER_PATHS = YES
OTHER_LDFLAGS = -framework SystemConfiguration -framework CFNetwork -framework MobileCoreServices -l z.1.2.3 -l xml2.2.7.3
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2"

@alloy alloy closed this as completed in 3a8a62f Sep 12, 2011
@alloy alloy reopened this Sep 12, 2011
@alloy
Copy link
Member Author

alloy commented Sep 12, 2011

Still need to write-up how the user should setup her project to use cocoa-pods.

@fabiopelosin
Copy link
Member

Can this issue be closed?

@alloy
Copy link
Member Author

alloy commented Aug 23, 2012

@irrationalfab Yeah definitely. I think it’s best if you just close tickets when you think that’s the correct course and optionally say ‘re-open if still applicable’ :)

@alloy alloy closed this as completed Aug 23, 2012
@JanC
Copy link

JanC commented Mar 13, 2013

Hi,
could you write a how to in the docs about how we are supposed to user CocoaPods in a Workspace that has both an "App" project and a static library project. I have troubles setting up such a environment. See this

https://groups.google.com/forum/?fromgroups=#!topic/cocoapods/DOVaKHXzfnI

cheers,
Jan

@fabiopelosin
Copy link
Member

Regarding the thread on the mailing list

platform :ios, '6.0'
# Pods used by the main App project
pod 'MACachedImageView', '~> 1.0.0'
pod 'RegexKitLite', '~> 4.0'
pod 'CocoaLumberjack', '~> 1.6'
# Pods used by the library project
xcodeproj 'PStatsKit/PStatsKit/PStatsKit'
target :PStatsKit do
    pod 'RegexKitLite', '~> 4.0'
end

The xcodeproj directive refers to the current target so a correct setup would have been:

target :PStatsKit do
  xcodeproj 'PStatsKit/PStatsKit/PStatsKit'
  pod 'RegexKitLite', '~> 4.0'
end

@JanC
Copy link

JanC commented Mar 13, 2013

Hi,
I tried doing as you wrote in this project

https://www.dropbox.com/s/7blzr46ckgi8wua/MyApp2.zip

but I'm getting the error

could not automatically select an Xcode workspace. Specify one in your Podfile.

The Podfile included in the zip is:

platform :ios, '6.0'


target :MyApp do
    pod 'MBProgressHUD', '~> 0.5'
    pod 'SEHumanizedTimeDiff', '~> 0.0.1'
end


target :MyLibrary do
    xcodeproj 'MyLibrary'
    pod 'SEHumanizedTimeDiff', '~> 0.0.1'
end

@fabiopelosin
Copy link
Member

When there is one than more project you need to specify the name of the workspace manually:

workspace 'MyApp'
platform :ios, '6.0'

target :MyApp do
    pod 'MBProgressHUD', '~> 0.5'
    pod 'SEHumanizedTimeDiff', '~> 0.0.1'
end


target :MyLibrary do
    xcodeproj 'MyLibrary'
    pod 'SEHumanizedTimeDiff', '~> 0.0.1'
end

@JanC
Copy link

JanC commented Mar 14, 2013

thanks @irrationalfab, that worked ;)

@JanC
Copy link

JanC commented Mar 16, 2013

Hi,
yet another problem :( If MyLibrary uses pod 'ASIHTTPRequest', '~> 1.8.1', I get a linker error:

can't locate file for: -lxml2.2
file: -lxml2.2 is not an object file (not allowed in a library)
can't locate file for: -lz.1
file: -lz.1 is not an object file (not allowed in a library)

This is the same problem as in #830 ... but shouldn't CocoaPods handle this ?

jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
Fixed issue with JSONKit categories
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
Adding SimplePurchase 0.0.1 Podspec
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
Merge latest commits from CocoaPods Specs
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013
Merging upstream from CocoaPods.
alloy added a commit that referenced this issue Oct 25, 2014
…rations on. Also fix a few more other settings in the template. Closes #1.
kylef pushed a commit that referenced this issue Feb 17, 2015
Sync main master with czechboy0 master
zhuyashan added a commit to zhuyashan/CocoaPods that referenced this issue Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants