Monday, October 24, 2016

[iOS | Cocoapods] duplicate symbol _OBJC_CLASS_$_PodsDummy_Pods_packager

Build multiple frameworks with cocoapods-packager, if you get the following error when integrating those frameworks into your project :

duplicate symbol _OBJC_CLASS_$_PodsDummy_Pods_packager in:
    /var/folders/4j/b_y7bj6n7qd7ttmw20nn4bww0000gn/T/CocoaPods/Lint/Pods/ABC/AAA.framework/AAA(Pods-packager-dummy.o)
    /var/folders/4j/b_y7bj6n7qd7ttmw20nn4bww0000gn/T/CocoaPods/Lint/Pods/DEF/DDD.framework/DDD(Pods-packager-dummy.o)


I'm not familiar with Ruby and it's difficult for me to find the reason and fix it. But here is a temporary solution, just to edit the following files to make sure the `-dummy.m` unique then re-package the framework:

$ sudo vi /Users/xiangwei/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.1.1/lib/cocoapods/target.rb +174


$ sudo vi /Users/xiangwei/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/cocoapods-1.1.1/lib/cocoapods/generator/dummy_source.rb +8