ios - 体系结构 x86_64 的 undefined symbol : "_OBJC_CLASS_$_GNSMessageManager" - NearBy native development for iOS in flutter app

标签 ios xcode flutter google-nearby google-nearby-messages

只是尝试在 flutter 应用程序中本地构建附近会引发错误

架构 x86_64 的 undefined symbol : “_OBJC_CLASS_$_GNSMessageManager”,引用自: AppDelegate.o 中的 objc-class-ref ld:未找到架构 x86_64 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

我尝试更改build设置架构并构建阶段链接二进制文件与库,但对我来说没有任何作用。

Info.plist文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>elsetestsd</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSMicrophoneUsageDescription</key>
    <string>The microphone listens for anonymous tokens from nearby devices.</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>

只需在我的应用程序委托(delegate)中包含一段代码

#import "AppDelegate.h"
#import <GNSMessages.h>
#import "GeneratedPluginRegistrant.h"

@interface AppDelegate ()

@property(nonatomic) GNSMessageManager *messageManager;
@end

pod 文件

# Uncomment the next line to define a global platform for your project
 platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'Runner' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  # Pods for Runner
  pod 'NearbyMessages'
end

最佳答案

您似乎正在尝试在模拟器上进行测试,但您使用的二进制库不是使用 arch x86_64 构建的。

要么向他们查找或请求通用库,要么在 iOS 设备上测试您的应用程序,我认为他们确实支持(armv7 或 arm64)。

关于ios - 体系结构 x86_64 的 undefined symbol : "_OBJC_CLASS_$_GNSMessageManager" - NearBy native development for iOS in flutter app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61736782/

相关文章:

android - flutter build apk错误

ios - 有没有一种方法可以对生成的GIF进行无损压缩?

ios - 应用程序在 tableview 的 reloadData 方法上崩溃

ios - 根据变量的值从 Plist 读取数据

ios - 捕获 UIView 的屏幕截图 - 性能缓慢

xcode - 谷歌地图集成到 SwiftUI

iphone - 将 txt 文件转换为带有实例类型变量的 NSArray

swift - 如何在 TableView 单元格上的 Collection View 数据源中调用多个CollectionView

android - Flutter - 在 Android 上覆盖插件实现

asynchronous - 根据另一个 Future 的结果创建 Future