iphone - iOS Static Library + CocoaPods and the duplicate symbols error -


i'm developing static library / ios framework (jeff verkoeyen way) , i've added cocoapods manage dependencies (this big difference other questions duplicate symbols).

i've been struggling "duplicate symbols" problem when client use cocoapods use static library / framework , 3rd party library i'm using too.

i've been reading answers talking not including 3rd party libraries custom static library want way, not option.

i've found this article (thank ryan arana) talks problem , "the best" solution , i've had adapt cocoapods driven static library:

1. create empty namespaceddependencies.h in root of workspace , add main project.

2. add prefix header of main project (before include of pods):

    #import "namespaceddependencies.h" 

3. add hook podfile:

    post_install | installer |        environment_header = installer.config.project_pods_root + 'pods-environment.h'       text = "#import \"namespaceddependencies.h\"\n\n" + environment_header.read       environment_header.open('w') { |file| file.write(text) }        dummy_class = installer.config.project_pods_root + 'pods-dummy.m'       text = "#import \"namespaceddependencies.h\"\n\n" + dummy_class.read       dummy_class.open('w') { |file| file.write(text) }      end 

4. copy ryan arana's script root , edit variables.

5. add "run script build phase" pods target with:

    ./generate_namespace_header.sh 

6. build workspace. at point have namespaceddependencies.h macros.

7. comment or remove "run script build phase" has been created before.

8. build again.

problems: works has problems:

1. require manual steps. when add/remove pod to/from podfile (and run pod install) i've clean workspace (iphoneos , iphonesimulator in case), left namespaceddependencies.h empty, add "run script build phase" (its removed cocoapods) , start again.

2. don't know if post_install hook ok, copied code somewhere , change i'm sure must better way this. can't find documentation it.

edited:

  • i'm using cocoapods 0.29.0, xcode 5 , ios 7
  • ryan arana's script modification of nimbus' script. "original" featherless's answer me lot. (see ryan arana's article)
  • when run "pod install", "run script build phase" , namespaceddependencies.h includes deleted. why i've create phase every time add/remove pod, , why i've added hook add includes.
  • i add import pods-environment.h because it's imported in prefix header of each pod. configuration change in future versions find way this. don't know how add each pch anyway. "general" pod target has no pch i've add pods-dummy.m directly.
  • if don't comment or remove "run script build phase" when namespaceddependencies.h macros , libpods.a created, macros recreated prefixed symbols , goes wrong.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -