Search code examples
swiftxcodecocoapods

Error of 48 duplicate symbols for architecture x86_64


I had error:48 duplicate symbols for architecture x86_64:enter image description here when I followed the tutorial: https://firebase.google.com/docs/cloud-messaging/ios/client#analytics-enabled, after install required libraries in cocoapods, it started to pop me this error message:enter image description here Then I followed my discussion to remove -ObjeC in other linker flags in this StackOverflow discussion: Duplicate symbols for architecture x86_64 under Xcode, but I did it in my project IFTTT rather than pods, should I do remove -ObjeC in other in Pods or my project? I did it on my project page, and after removing it, it still displays -ObjeC on the setting page, and I still got the same error message:enter image description here does anyone know why? Yea I was totally in a mess, can someone please help me with this? thank you!

Update: I came out the solution in my case, I had cocoapods and some libraries installed before, I am trying to set up firebase, so if you encounter these problems when installing firebase, definitely reference this post. I followed the answer below, and before that, I added:

  post_install do |installer|
installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
    config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = "NO"
  end
end
end

and then did following command:

$ sudo gem install cocoapods-deintegrate cocoapods-clean
$ pod deintegrate
$ pod cache clean --all
$ pod install

as answer shows, then everything worked out, I did delete some duplicate files when there was file.c and file 2.c, but I didn't delete all to try, I just did what I had above and fix this problem, hope this will help future developers, don't freak out! trust yourself and other people from StackOverflow!


Solution

  • Sometimes that happens with me when I try to update pods. What happens is a duplicate of some files in pods gets added in. It will look something like this:

    Firebase.h
    Firebase 2.h
    

    You could just go through all the pods you installed and delete the duplicates, or you can deintegrate and install again.

    $ sudo gem install cocoapods-deintegrate cocoapods-clean
    $ pod deintegrate
    $ pod cache clean --all
    $ pod install