I spend hours trying Extension target to use separate pods config from main target. The reason for that is that Pods are duplicated for extension target and thus making your whole app about twice in size. Need to make Extension contain only pods that's necessary there.
There seem to be some magic that XCode does when embedding Extension into main target, and CocoaPods seem to be oblivious to that whole procedure? Or I am doing it wrong? I tried al kinds of Podfile configurations, nothing works. Anyone was able to successfully achieve that?
to reproduce:
- Create a new project, target "MainTarget"
- select Add Target > Today Extension, name target "Extension"
- Create podfile:
target 'MainTarget' do pod 'RestKit', '~> 0.20.3' pod 'AFNetworking', '~> 1.3.1' pod 'SSKeychain', '~> 1.2.0' pod "MagicalRecord/Shorthand", '~> 2.2' pod 'StyledPageControl', '~> 1.0' pod 'GoogleAnalytics-iOS-SDK', '~> 3.0.2' end target 'Extension' do pod 'AFNetworking', '~> 1.3.1' end
4 run pod install
5 build
result:
/Users/d/Library/Developer/Xcode/DerivedData/MainTarget-fvmcyblwdybpkdgfzflcjhqpjxab/Build/Products/Debug-iphonesimulator/libPods.a(AFHTTPRequestOperation.o)
/Users/d/Library/Developer/Xcode/DerivedData/MainTarget-fvmcyblwdybpkdgfzflcjhqpjxab/Build/Products/Debug-iphonesimulator/libPods-MainTarget.a(AFHTTPRequestOperation.o)
duplicate symbol _OBJC_IVAR_$_AFHTTPRequestOperation._successCallbackQueue in:
/Users/d/Library/Developer/Xcode/DerivedData/MainTarget-fvmcyblwdybpkdgfzflcjhqpjxab/Build/Products/Debug-iphonesimulator/libPods.a(AFHTTPRequestOperation.o)
/Users/d/Library/Developer/Xcode/DerivedData/MainTarget-fvmcyblwdybpkdgfzflcjhqpjxab/Build/Products/Debug-iphonesimulator/libPods-MainTarget.a(AFHTTPRequestOperation.o)
...(and so on... every file repeated 4 times.)
ld: 2148 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)