How to remove duplicate files generated through cocoa pods in iOS
I have fixed the above issue as below
At my Xcode project -- Build Settings -- Other linker Flags -- I removed -all_load
then some of the duplicate errors are gone.
Still I get Socket Rocket duplicate warnings after the above solution.
I fixed this by going to Pods Project -- Selected Socket Rocket pods target -- Removed the SRWebSocket.m
file from Compiling. It works fine and duplicates are removed.
Thanks for all answers..
You need to remove the socketrocket object code from libWebRTC.a
run lipo -info libWebRTC.a
to see what architectures are in the library (current version is i386, armv7, and arm64)
Then run
lipo libWebRTC.a -thin i386 -output libWebRTC-i386.a
Do this for each architecture by replacing i386 with the relevant value. You then need to extract the object files from each archive.
mkdir libWebRTC-i386 && cd libWebRTC-i386 && ar -x ../libWebRTC-i386.a
Do this for each of the new single architecture libraries you've just created. In each of the new folders you will find .o files that contain "socketrocket" - delete these.
Then re-archive the object files for each architecture
libtool -static *.o -o ../libWebRTC-i386.a
Once you have done this re-combine them into a fat library
lipo -create libWebRTC-armv7.a libWebRTC-arm64.a libWebRTC-i386.a -output libWebRTC.a
And voila, it should now work. Really the libWebRTC.a binary needs re-building without the socket rocket object code, and socket rocket should be added as a dependency to the podspec.
Solution
- Backup your project
- Close the Xcode
https://github.com/kylef/cocoapods-deintegrate
run the command line below :
pod deintegrate
remove the Podfile.lock file in your project directory
run install again :
pod install
Open Xcode and Clean your project and Derived Data directory then run again
Hope this solution will fix your problem.
Best