3
votes

Undefined symbols for architecture x86_64: "OBJC_CLASS$_UIPointerShape", referenced from: objc-class-ref in GoogleMaps "OBJC_CLASS$_UIPointerStyle", referenced from: objc-class-ref in GoogleMaps ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

  • I have checked Framework, Library linkage in General Setting of Xcode, It has linked correctly.
  • I have used Standard architecture $(ARCHS_STANDARD).
  • I have linked binary and libraries in build phases.
  • I am using XCODE 11 and simulator with iOS 13.2 to run.

Any help is appreciated!

3

3 Answers

1
votes

This issue comes with 3rd party library file build exclude x86_64 arch. use command file to check it, like:

file /usr/lib/libc++abi.dylib
/usr/lib/libc++abi.dylib: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386] [x86_64:Mach-O 64-bit dynamically linked shared library x86_64]
/usr/lib/libc++abi.dylib (for architecture i386):   Mach-O dynamically linked shared library i386
/usr/lib/libc++abi.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
0
votes

There are many ways to get rid of this error!

  1. manually: Add below code in run script of Project target, this remove the simulator architecture (x86_64 and i386) from your app on building process:

Shell:

    /bin/sh

Code:

    APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

    # This script loops through the frameworks embedded in the application and
    # removes unused architectures.
    find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
    do
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

    EXTRACTED_ARCHS=()

    for ARCH in $ARCHS
    do
    echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
    lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
    EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    done

    echo "Merging extracted architectures: ${ARCHS}"
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
    rm "${EXTRACTED_ARCHS[@]}"

    echo "Replacing original executable with thinned version"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

    done

2.Do it just before deploying the app on Testflight/App-store.

Go inside the your ProjectFramework.framework folder of your project from terminal. Run following commands:

    lipo -remove i386 ProjectFramework_SDK -o ProjectFramework_SDK 
    lipo -remove x86_64 ProjectFramework_SDK -o ProjectFramework_SDK

By doing this You Can't run on Simulator.

Check the architecture from frameworks? $ lipo -info PathToProject/ProjectName.framework/ProjectName and also you check using

    file /usr/lib/libc++abi.dylib
    /usr/lib/libc++abi.dylib: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386] [x86_64:Mach-O 64-bit dynamically linked shared library x86_64]
    /usr/lib/libc++abi.dylib (for architecture i386):   Mach-O dynamically linked shared library i386
    /usr/lib/libc++abi.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64

Ref. doc: http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/

0
votes

upgrade version is problem of google maps .Use this lower version of Google maps .

pod 'GoogleMaps', '~> 3.9.0' or

pod 'GoogleMaps', '2.5.0'