qiuxiang / react-native-amap-geolocation

React Native geolocation module for Android + iOS
https://qiuxiang.github.io/react-native-amap-geolocation
MIT License
389 stars 103 forks source link

1.2.0版本安卓正常,ios m1 arm架构下无法编译启动; #158

Open xuewenjie123 opened 2 years ago

xuewenjie123 commented 2 years ago

Xcode :14.1 "react-native-amap-geolocation": "^1.2.0" "react-native": "0.69.4"

删除react-native-amap-geolocation包后,重新执行pod install则可正常启动;

运行 npx react-native run-ios 报错; ld: warning: ignoring file /Users/xxx/Library/Developer/Xcode/DerivedData/hscy_app-fjtzylwkeoyzyscpwkafipnyyazi/Build/Products/Debug-iphonesimulator/react-native-amap-geolocation/libreact-native-amap-geolocation.a, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64 Undefined symbols for architecture x86_64: "_OBJCCLASS$_RCTBridge", referenced from: objc-class-ref in AppDelegate.o "_OBJCCLASS$_RCTBundleURLProvider", referenced from: objc-class-ref in AppDelegate.o "_OBJCCLASS$_RNSplashScreen", referenced from: objc-class-ref in AppDelegate.o "_RCTAppSetupDefaultRootView", referenced from: -[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o "_RCTAppSetupPrepareApp", referenced from: -[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hscy_app' from project 'hscy_app') warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hscy_app' from project 'hscy_app')

BUILD FAILED

The following build commands failed: Ld /Users/xxx/Library/Developer/Xcode/DerivedData/hscy_app-fjtzylwkeoyzyscpwkafipnyyazi/Build/Products/Debug-iphonesimulator/hscy_app.app/hscy_app normal (in target 'hscy_app' from project 'hscy_app') (1 failure)

info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command

qiuxiang commented 2 years ago

这是因为高德 SDK 没有给模拟器提供 arm64 版,你要测试的话要运行到真机,或者运行到 macos 上

wubaibin commented 2 years ago

Xcode :14.1 "react-native-amap-geolocation": "^1.2.0" "react-native": "0.69.4"

删除react-native-amap-geolocation包后,重新执行pod install则可正常启动;

运行 npx react-native run-ios 报错; ld: warning: ignoring file /Users/xxx/Library/Developer/Xcode/DerivedData/hscy_app-fjtzylwkeoyzyscpwkafipnyyazi/Build/Products/Debug-iphonesimulator/react-native-amap-geolocation/libreact -native-amap-geolocation.a,为 iOS Simulator-x86_64 构建,但尝试链接为 iOS Simulator-arm64 构建的文件 x86_64 架构的未定义符号: “ _OBJCCLASS $_RCTBridge”,引用自: AppDelegate 中的 objc-class-ref。 o “ _OBJCCLASS $_RCTBundleURLProvider”,引用自: AppDelegate.o 中的 objc-class-ref “ _OBJCCLASS $_RNSplashScreen”,引用自: AppDelegate.o 中的 objc-class-ref “_RCTAppSetupDefaultRootView”,引用自: AppDelegate.o 中的 - [ AppDelegate 应用程序:didFinishLaunchingWithOptions:] : 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

警告:运行脚本构建阶段“Start Packager”将在每次构建期间运行,因为它没有指定任何输出。要解决此警告,请将输出依赖项添加到脚本阶段,或者通过在脚本阶段取消选中“基于依赖项分析”将其配置为在每个构建中运行。(在项目“hscy_app”的目标“hscy_app”中) 警告:运行脚本构建阶段“Bundle React Native 代码和图像”将在每次构建期间运行,因为它没有指定任何输出。要解决此警告,请将输出依赖项添加到脚本阶段,或者通过在脚本阶段取消选中“基于依赖项分析”将其配置为在每个构建中运行。(在项目“hscy_app”的目标“hscy_app”中)

构建失败

以下构建命令失败: Ld /Users/xxx/Library/Developer/Xcode/DerivedData/hscy_app-fjtzylwkeoyzyscpwkafipnyyazi/Build/Products/Debug-iphonesimulator/hscy_app.app/hscy_app 正常(在项目“hscy_app”的目标“hscy_app”中) (1 次失败)

info 使用 --verbose 标志运行 CLI 以获取更多详细信息。 error 命令失败,退出代码为 1。 info 访问https://yarnpkg.com/en/docs/cli/run以获取有关此命令的文档

请问真机上可以正常运行吗

xuewenjie123 commented 2 years ago

这是因为高德 SDK 没有给模拟器提供 arm64 版,你要测试的话要运行到真机,或者运行到 macos 上

好的谢谢您!我完了测试下

xuewenjie123 commented 2 years ago

Xcode :14.1 "react-native-amap-geolocation": "^1.2.0" "react-native": "0.69.4" 删除react-native-amap-geolocation包后,重新执行pod install则可正常启动; 运行 npx react-native run-ios 报错; ld: warning: ignoring file /Users/xxx/Library/Developer/Xcode/DerivedData/hscy_app-fjtzylwkeoyzyscpwkafipnyyazi/Build/Products/Debug-iphonesimulator/react-native-amap-geolocation/libreact -native-amap-geolocation.a,为 iOS Simulator-x86_64 构建,但尝试链接为 iOS Simulator-arm64 构建的文件 x86_64 架构的未定义符号: “ _OBJCCLASS $_RCTBridge”,引用自: AppDelegate 中的 objc-class-ref。 o “ _OBJCCLASS $_RCTBundleURLProvider”,引用自: AppDelegate.o 中的 objc-class-ref “ _OBJCCLASS $_RNSplashScreen”,引用自: AppDelegate.o 中的 objc-class-ref “_RCTAppSetupDefaultRootView”,引用自: AppDelegate.o 中的 - [ AppDelegate 应用程序:didFinishLaunchingWithOptions:] : 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) 警告:运行脚本构建阶段“Start Packager”将在每次构建期间运行,因为它没有指定任何输出。要解决此警告,请将输出依赖项添加到脚本阶段,或者通过在脚本阶段取消选中“基于依赖项分析”将其配置为在每个构建中运行。(在项目“hscy_app”的目标“hscy_app”中) 警告:运行脚本构建阶段“Bundle React Native 代码和图像”将在每次构建期间运行,因为它没有指定任何输出。要解决此警告,请将输出依赖项添加到脚本阶段,或者通过在脚本阶段取消选中“基于依赖项分析”将其配置为在每个构建中运行。(在项目“hscy_app”的目标“hscy_app”中) 构建失败 以下构建命令失败: Ld /Users/xxx/Library/Developer/Xcode/DerivedData/hscy_app-fjtzylwkeoyzyscpwkafipnyyazi/Build/Products/Debug-iphonesimulator/hscy_app.app/hscy_app 正常(在项目“hscy_app”的目标“hscy_app”中) (1 次失败) info 使用 --verbose 标志运行 CLI 以获取更多详细信息。 error 命令失败,退出代码为 1。 info 访问https://yarnpkg.com/en/docs/cli/run以获取有关此命令的文档

请问真机上可以正常运行吗

暂时没有真机,抱歉没有测试过,不过让x86的朋友远程测试过确实可以运行

magic3584 commented 1 year ago

M1 如下配置就可以运行模拟器上

image

fengxiao361 commented 1 year ago

大佬真是救我狗命,感谢分享!😂