架构x86_64的未定义符号:“ _ OBJC_CLASS _ $ _ UIPointerShape”,“ _ OBJC_CLASS _ $ _ UIPointerStyle”

时间:2020-09-19 05:23:22

标签: ios swift xcode google-maps reference

x86_64体系结构的未定义符号: “ OBJC_CLASS $ _ UIPointerShape”,引用自: GoogleMaps中的objc-class-ref “ OBJC_CLASS $ _ UIPointerStyle”,引用自: GoogleMaps中的objc-class-ref ld:找不到架构x86_64的符号 铛:错误:链接器命令失败,退出代码为1(使用-v查看调用)

enter image description here

  • 我在Xcode的常规设置中检查了框架,库链接,它已正确链接。
  • 我使用了标准架构$(ARCHS_STANDARD)。
  • 我已经在构建阶段链接了二进制文件和库。
  • 我正在将XCODE 11和模拟器与iOS 13.2一起运行。

感谢您的帮助!

3 个答案:

答案 0 :(得分:0)

此问题与第3方库文件的构建无关,但不包括x86_64 arch。使用命令file进行检查,例如:

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

答案 1 :(得分:0)

有很多方法可以消除此错误!

  1. 手动: 在Project target的运行脚本中添加以下代码,这会在构建过程中从您的应用中删除模拟器架构(x86_64和i386):

Shell:

    /bin/sh

代码:

    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。在将应用程序部署到Testflight / App-store上之前执行此操作。

从终端进入项目的ProjectFramework.framework文件夹。运行以下命令:

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

执行此操作将无法在Simulator上运行。

从框架检查架构? $ lipo -info PathToProject / ProjectName.framework / ProjectName 你也用

    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

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

答案 2 :(得分:-1)

升级版本是谷歌地图的问题。使用这个低版本的谷歌地图。

pod 'GoogleMaps'、'~> 3.9.0' 或

pod 'GoogleMaps', '2.5.0'