Rajat Khare Rajat Khare - 10 days ago 5
Swift Question

Linker Error occurs when using Firebase and Google pods

I am having a linker error being produced on build and I don't know how to fix it. I have already tried many solutions on stackoverflow and none of them have worked for me. Any help is appreciated.

(summary of error: ld: 44 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error Message:

Linker Error

Answer

To begin, I had looked through many solutions and tried all of them, but none of them had worked, so I started to go through these steps:

  1. Recreate the project, but keep the important things. I recreated the project by copying the Assets and Main.storyboard files into the new one I had created.

  2. Installing the Pods correctly. I went into terminal, and watched the video carefully, where it explained that the pods needed were only Firebase/Auth and GoogleSignIn. I then used pod init to initialize the pods in my project. Then, I used open Podfile, so that I could install the pods I needed. When I was in the Podfile, I turned off smart quotes because that had created some errors in my project before. I then typed in pod 'Firebase/Auth' and pod 'GoogleSignIn' I then saved the file, and ran pod install. Afterwards, you must open the .xcworkspace file for your project and not the original project file.

  3. Coding the ViewController.swift and AppDelegate files. I went through the tutorial I was using, and inputted the same code that the guy was telling us to code. After carefully coding all of these files, the code ran well and everything worked!

Comments