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

There are 1 answers

0
Declan Stewart McPartlin On

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).