Duplicate symbols for architecture x86_64

Hey guys!
I’m a newbie to coding and I’m currently coding my first App…I started with integrating Google Sign In, as I’m doing this I run into the following error, when I try to run the Simulator: 97 duplicate symbols for architecture x86_64.
I couldn’t fix the problem over the last days and I hope somebody can help me!

Here’s also my AppDelegate.swift:

//
// AppDelegate.swift
//
//
// Created by Maurice on 6/20/20.
// Copyright © 2020. All rights reserved.
//

import UIKit
import GoogleSignIn

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    GIDSignIn.sharedInstance().clientID = "..."
    GIDSignIn.sharedInstance().delegate = self
    return true
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {

func application(_ application: UIApplication,
open url: URL, sourceApplication: String?, annotation: Any) → Bool {
return GIDSignIn.sharedInstance().handle(url)
}

}
}

func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!,
withError error: Error!) {
if let error = error {
if (error as NSError).code == GIDSignInErrorCode.hasNoAuthInKeychain.rawValue {
print(“The user has not signed in before or they have since signed out.”)
} else {
print(“(error.localizedDescription)”)
}
return
}
// Perform any operations on signed in user here.
let userId = user.userID // For client-side use only!
let idToken = user.authentication.idToken // Safe to send to the server
let fullName = user.profile.name
let givenName = user.profile.givenName
let familyName = user.profile.familyName
let email = user.profile.email
print(fullName)
}

func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!,
withError error: Error!) {
print(“User has disconnected”)
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
    // Called when a new scene session is being created.
    // Use this method to select a configuration to create the new scene with.
    return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
    // Called when the user discards a scene session.
    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}

Regards,
Maurice ( ;

Hi Maurice,

Some of your code is not within the class braces and you have used the the wrong double quotes in your print() statements.

Try copying this rearranged version into your project to see if it makes any difference.

import UIKit
import GoogleSignIn

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }
    
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        func application(_ application: UIApplication,
                         open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
            return GIDSignIn.sharedInstance().handle(url)
        }
        
    }
    
    func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!,
              withError error: Error!) {
        if let error = error {
            if (error as NSError).code == GIDSignInErrorCode.hasNoAuthInKeychain.rawValue {
                print("The user has not signed in before or they have since signed out.")
            } else {
                print("(error.localizedDescription)")
            }
            return
        }
        // Perform any operations on signed in user here.
        let userId = user.userID // For client-side use only!
        let idToken = user.authentication.idToken // Safe to send to the server
        let fullName = user.profile.name
        let givenName = user.profile.givenName
        let familyName = user.profile.familyName
        let email = user.profile.email
        print(fullName)
    }

    func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!,
              withError error: Error!) {
        print("User has disconnected")
    }

    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }

}

Apparently It didn’t help ) :

Regards,
Maurice

What errors do you have now?

It’s still the same. 97 duplicate symbols for architecture x86_64 ) :

Can you proved a screen capture of the error messages and also a copy of the error messages that are listed in the console.

The build in screenshot app will enable you to select an area of the screen to copy or you can select the entire screen or a specific App window.

I removed CocoaPods from the project and did the whole thing again. The error is away now…anyways, XCode is now giving me an error saying: 'Use of unresolved identifier “self”.
The error occurs next to this function: GIDSignIn.sharedInstance().delegate = self

The function is declared in the Google Development Guide, but doesn’t work for me :thinking:

I link some screenshots of the problem and also my AppDelegate ( :
Thanks for your awesome help!

Regards,
Maurice

AppDelegate.swift:

//
// AppDelegate.swift
//
//
// Created by Maurice on 6/28/20.
// Copyright © 2020 mauricemark. All rights reserved.
//

import UIKit
import GoogleSignIn

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if (error as NSError).code == GIDSignInErrorCode.hasNoAuthInKeychain.rawValue {
print(“The user has not signed in before or they have since signed out.”)
} else {
print(“(error.localizedDescription)”)
}
return
}
}

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) → Bool {
// Initialize sign-in
GIDSignIn.sharedInstance().clientID = “my_client_ID”
GIDSignIn.sharedInstance().delegate = self
return true
}

@available(iOS 9.0, *)
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) → Bool {
return GIDSignIn.sharedInstance().handle(url)

}

func application(_ application: UIApplication,
open url: URL, sourceApplication: String?, annotation: Any) → Bool {
return GIDSignIn.sharedInstance().handle(url)
}

func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!,
withError error: Error!) {
if let error = error {
if (error as NSError).code == GIDSignInErrorCode.hasNoAuthInKeychain.rawValue {
print(“The user has not signed in before or they have since signed out.”)
} else {
print(“(error.localizedDescription)”)
}
return
}
// Perform any operations on signed in user here.
let userId = user.userID // For client-side use only!
let idToken = user.authentication.idToken // Safe to send to the server
let fullName = user.profile.name
let givenName = user.profile.givenName
let familyName = user.profile.familyName
let email = user.profile.email
print(fullName)
print(familyName)
print(email)

// …
}

func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!,
withError error: Error!) {
print(“User has disconnected”)
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
    // Called when a new scene session is being created.
    // Use this method to select a configuration to create the new scene with.
    return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
    // Called when the user discards a scene session.
    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}