Undefined symbols for architecture x86_64: “_OBJC_CLASS_$_GNSMessageManager” - NearBy native development for iOS in flutter app

橙三吉。 提交于 2021-01-29 12:23:42

问题


Just trying to build nearby natively in flutter app throws error

Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GNSMessageManager", referenced from: objc-class-ref 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)

I tried to change build setting architecture and build phase linked binary with library as well but nothing worked for me.

Info.plist file

<?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>

Just include a piece of code in my app delegate

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

@interface AppDelegate ()

@property(nonatomic) GNSMessageManager *messageManager;
@end

pod file

# 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

回答1:


It seems like you are trying to test on a simulator, but the binary library you are using is not built with the arch x86_64 included.

Either find or request a universal library from them, or test your application on an iOS device, which I presume they do have support for (either armv7 or arm64).



来源:https://stackoverflow.com/questions/61736782/undefined-symbols-for-architecture-x86-64-objc-class-gnsmessagemanager-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!