Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove duplicate files generated through cocoa pods in iOS

I am using cocoa pods to integrate multiple third party files into my project.

I have to integrate below pod into my project

xcodeproj 'MyApp'
workspace 'MyApp'

source 'https://github.com/CocoaPods/Specs.git'

target :"MyApp", :exclusive => true do

  platform :ios, '7.0'

  pod 'AFNetworking', '2.0.2'

  pod 'TwilioSDK', '~>1.2.2'

  pod 'SocketRocket', '0.3.1-beta2'

  pod 'AppRTC'

end

When I run pod install. I get duplicates as shown below..

SRWebSocket.h as duplicates

When I build my app I am getting error

ld: warning: directory not found for option '-L/Users/anand/Documents/
  Project/myApp_Backups/myApp_June/myApp_WEBRTC/Pods/build/Debug-
  iphoneos'
duplicate symbol _MD5_Update in:
    /Users/anand/Documents/Project/myApp_Backups/myApp_June/
  myApp_WEBRTC/Pods/AppRTC/Lib/libWebRTC.a(nss_static.md5.o)
    /Users/anand/Documents/Project/myApp_Backups/myApp_June/
  myApp_WEBRTC/Pods/TwilioSDK/Libraries/libcrypto.a(md5_dgst.o)
duplicate symbol _SHA1_Update in:

duplicate symbol _OBJC_IVAR_$_SRIOConsumer._readToCurrentFrame in:
    /Users/anand/Library/Developer/Xcode/DerivedData/myApp-
  gxdbyoohznnpigavdqmaeilzlavd/Build/Products/Debug-iphoneos/libPods-
  myApp-SocketRocket.a(SRWebSocket.o)
    /Users/anand/Documents/Project/myApp_Backups/myApp_June/
  myApp_WEBRTC/Pods/AppRTC/Lib/libWebRTC.a(socketrocket.SRWebSocket.o)

ld: 71 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I thought to do below solutions:

1) Remove SRWebSocket.h file -- but it may get errors as it is in Pods.

2) Remove pod 'SocketRocket', '0.3.1-beta2' from pod file and run pod install -- but I used both SRWebSocket.h and SRWebSocket.m in my project before installing AppRTC into my project..!

Please suggest how can I solve this issue..

Thanks in Advance..!

like image 201
Vidhyanand Avatar asked Jun 25 '15 13:06

Vidhyanand


1 Answers

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..

like image 51
Vidhyanand Avatar answered Oct 12 '22 02:10

Vidhyanand