Adding Firebase/Messaging CocoaPod causes iOS app to not build - ios

The iOS app worked fine before adding Firebase/Messaging, but after adding it and running 'pod update' I started getting these errors when building:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GTMLogger", referenced from:
objc-class-ref in FirebaseMessaging(GIPReachability_d54098c5c1e1fdc4fca31a4803478650.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my current Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'KarmaSous' do
pod 'Firebase'
pod 'FirebaseMessaging'
pod 'Firebase/Database'
pod 'Kingfisher', '~> 3.1.4'
pod "GMStepper"
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
Any help would be greatly appreciated, thank you!

Have you tried adding pod 'Firebase/Messaging' instead of pod 'FirebaseMessaging'?

I had same error, and I have solved the error.
Please make sure that "Edit Scheme > Build > Build Options > Find Implicit Dependencies" is checked.

Related

Undefined symbols for architecture arm64:"_OBJC_CLASS_$_FlutterError"

I wanted to implement image notification in a flutter app. I setup everything using this doc and when I run a real device, the image notification worked. ​
but, when i try to Archive the build i'm getting this error. I am able to take archive only if I delete the MyImageNotification target.
This is folder structure looks like once i completed setup of imagg notification
I got below message from the bottom of the error log
ld: warning: Could not find or use auto-linked framework 'Flutter'
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FlutterError", referenced from:
objc-class-ref in firebase_core(FLTFirebasePlugin.o)
objc-class-ref in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
"_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
objc-class-ref in firebase_core(FLTFirebaseCorePlugin.o)
objc-class-ref in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
objc-class-ref in firebase_messaging(FLTFirebaseMessagingPlugin.o)
"_FlutterMethodNotImplemented", referenced from:
-[FLTFirebaseCorePlugin handleMethodCall:result:] in firebase_core(FLTFirebaseCorePlugin.o)
-[FLTFirebaseDynamicLinksPlugin handleMethodCall:result:] in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
-[FLTFirebaseMessagingPlugin handleMethodCall:result:] in firebase_messaging(FLTFirebaseMessagingPlugin.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My PodFile look like this
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
target 'MyImageNotification' do
use_frameworks!
pod 'Firebase/Messaging'
end
Possible solution #1
Try inside ios folder:
rm -rf Pods/ Podfile.lock .symlinks Flutter/Flutter.podspec Runner.xcworkspace
pod repo update
pod install
Run archive
Possible solution #2
If steps above won't help, please ensure that your "Build Active Architecture Only" for target flavor is set to "no"
Possible solution #3
The idea is to bump target ios version. In your podfile set:
platform :ios, '10.0'
And modify your post install script the next way:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
Then reinstall pods (pod deintegrate, pod install)
looks like similer issue please : https://github.com/flutter/flutter/issues/95256

Why does my iOS app produce a dyld error on launch?

I have a project running on Xcode 12.3; it's in Objective-C and uses CocoaPods. The 3rd party libraries are built only for devices, not for simulators, so when I run my app on iPhone with iOS 13, the project builds successfully but I get the following error:
dyld: Symbol not found: _$s9SwiftGRPC17ServerSessionBaseC15initialMetadataAA0G0CvM
Referenced from: /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/Core.framework/Core
Expected in: /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/SwiftGRPC.framework/SwiftGRPC
in /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/Core.framework/Core
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
(lldb)
The pod file is as below:
pod 'SwiftGRPC', '~> 0.9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'CleverTap-iOS-SDK', '~> 3.7.1'
Why am I getting this error and how can I resolve it?
Have you tried setting BUILD_LIBRARY_FOR_DISTRIBUTION to true for all your frameworks to ensure module stability?
You'll need to set the flag to true in your app (under project settings) as well as in your dependencies by adding a post install script at the end of your Podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
Original solution here

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_GADMediatedNativeAdNotificationSource"

I'm having trouble implementing InMobi mediation SDK and adapter into iOS app. Built is resulting with error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GADMediatedNativeAdNotificationSource", referenced from:
objc-class-ref in InMobiAdapter(GADMAdapterInMobi.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm using coocapods as dependency manager. Here is my Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!
target 'APP-mobile' do
pod 'Google-Mobile-Ads-SDK'
pod 'GoogleMobileAdsMediationInMobi'
pod 'lottie-ios'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
end
target 'APP-desktop' do
end
I manage to solve it by using
pod 'InMobiSDK'
instead of
pod 'GoogleMobileAdsMediationInMobi'
and adding InMobiAdapter into project, download from here.
Complete instruction on InMobi Support Center.

Apple Mach-O Linker Error when migrating to Swift 3

I have to migrate a project from Swift 2.3 to Swift 3. In this application there is also Objective C parts. So far I experienced several issues, but this one is really giving me a hard time: I updated all the Swift 3 libraries accordingly, and now I get an error in one library that is primarily being used in the Objective C part, which i don't know much of.
I run into this build issue:
ld: framework not found CocoaLumberjack
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is my pod file:
target 'SmartSpaces' do
xcodeproj 'SmartSpaces/SmartSpaces.xcodeproj'
pod 'CorePlot', :git => 'https://github.com/core-plot/core-plot.git'
pod 'Fingertips'
pod 'ReactiveCocoa', '~> 2.3.0'
pod 'CocoaLumberjack', '~> 2.0.2'
pod 'RestKit', '~> 0.26' end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.to_s == 'RestKit'
target.build_configurations.each do |config|
config.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework "CocoaLumberjack"'
end
end
end
Does anybody know how this issue can be fixed?

"framework not found AFNetworking for architecture arm64" for my Test Target

This is what I see when trying to run tests under test target in my iOS App:
ld: framework not found AFNetworking for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is how my podfile looks like:
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "8.2"
def pods
pod 'AFNetworking'
pod 'Fabric'
pod 'Crashlytics'
pod 'MagicalRecord'
pod 'SDWebImage'
pod 'SVProgressHUD'
end
target 'MySoberRoomMate' do
pods
end
inhibit_all_warnings!
I am new on IOS development and did not have the required reputation to add comment so that I am posting answer.
I did a little work with pod file and i think the pods for the test target is not added in pod file so that the compiler showing the error.
do some thing like this in the pod file for the test target
target 'TestTarget' do
pods
end
add your test target name in place of 'TestTarget'
Hope it works.

Resources