Recently, we have discovered an error that happens during the compilation of a Flutter app for iOS when there is both Firebase plugins and an App Extension(s) present.
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_$_FlutterMethodChannel", referenced from: objc-class-ref in firebase_analytics(FLTFirebaseAnalyticsPlugin.o) objc-class-ref in firebase_core(FLTFirebaseCorePlugin.o) objc-class-ref in firebase_crashlytics(FLTFirebaseCrashlyticsPlugin.o) "_FlutterMethodNotImplemented", referenced from: -[FLTFirebaseAnalyticsPlugin handleMethodCall:result:] in firebase_analytics(FLTFirebaseAnalyticsPlugin.o) -[FLTFirebaseCorePlugin handleMethodCall:result:] in firebase_core(FLTFirebaseCorePlugin.o) -[FLTFirebaseCrashlyticsPlugin handleMethodCall:result:] in firebase_crashlytics(FLTFirebaseCrashlyticsPlugin.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Those are the errors that showed up after I added a few Firebase plugins to our Flutter application. The small difference between this and other apps is the fact, that ours has an App Extension.
For some reason, Xcode was complaining about the lack of Flutter framework in the App Extension, even though it was never used nor referenced inside.
As it turned out, it's all due to how the linking works in Flutter apps. By default, our App Extension target in the Xcode was inheriting the values from the parent project which contained all the frameworks from Podfile, and hence all the Flutter plugins' pods. Including `firebase_core`, `firebase_analytics`, and `firebase_crashlytics`, as they are the ones that caused the compilation error above.
The solution for this problem was removing those frameworks from the linking and this solved the issue. The steps were:
1. Go to your App Extension target in Xcode.
2. Open Build Settings -> All -> Combined.
3. Locate _Other Linker Flags_.
Here you'll see all the inherited flags, including stuff like `-framework "firebase_core"`.
4. Remove all the problematic framework references with their corresponding `-framework` prefix AND the `$(inherited)` from the very beginning.
Done!
This solution is based on the [andreasunterhuber's comment] (https://github.com/flutter/flutter/issues/16092#issuecomment-475237976) from a GitHub issue; thank you!
10 min • Nov 17, 2020
Firestore and Firebase suite are great technologies. They allow developers to build some features in Flutter and other mobile frameworks really fast. However, Firestore has also many pain points that outweigh the pros in most of the more advanced cases. Is Firestore appropriate for you? Read on to find out why!
10 min • Nov 20, 2020
Firestore (and Firebase) is a really great solution for many different use cases. However, there is a number of limitations that make using Firestore painful. Tricky latency, data migration problems, and complicated privacy are just the beginning of the trouble. Read the article to find out why!
6 min • Dec 2, 2020
It's worth understanding the Firestore limitations and how to overcome them before you start building your next web or mobile application using native or cross-platform solutions like Flutter, React Native, or Kotlin. Read hints on how to use Firestore effectively and not hurt yourself in the process.
This is our final article about Firestore! Have you realized that Firestore makes your life more difficult? At first sight, Firestore seems like a perfect fit for your use case but then the bad things happen. If you're looking for the way out - in this part we'll show you how to escape from Firestore!