Search code examples
javascriptionic-frameworkcapacitor

Xcode 13 mac m1 chip google signin build gives building for iOS Simulator,but linking in object file built for iOS


I use this plugin @codetrix-studio/capacitor-google-auth

and I perform all steps one by one in ANDROID is working but when I build for IOS its open Xcode but when I run the target app it's give me this error

in APP_PATH/ios/App/Pods/GoogleSignIn/Frameworks/GoogleSignIn.
framework/GoogleSignIn(GIDEMMErrorHandler_3a47e13d8ca81b41e9cdb7ef5468004a.o),
building for iOS Simulator,but linking in object file built for iOS, file 
'APP_PATH/ios/App/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn' 
for architecture arm64

Solution

  • try with this

    you have to add this code to your Podfile

    post_install do |installer|
     installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
     end
    end
    

    After adding this code install pod

    pod install
    

    and add this code in capacitor.config.json

    "GoogleAuth": {
            "scopes": [
                "profile",
                "email"
            ],
            "serverClientId": "YOUR_API_KEY.apps.googleusercontent.com",
            "forceCodeForRefreshToken": true
        }
    

    and in Xcode

    enter image description here

    after adding your key clean project and run.

    and add arm64 in Building Settings and find Excluded Architecture

    enter image description here