KasemJaffer / receive_sharing_intent

A Flutter plugin that enables flutter apps to receive sharing photos, text and url from other apps.
Apache License 2.0
325 stars 374 forks source link

iOS debug/build error #203

Closed rensvis closed 2 years ago

rensvis commented 2 years ago

I'm running into an error when trying to run my app. It's working great on Android but iOS is causing me headaches. I've carefully followed the Readme and I'm still getting errors when trying to run the project on the iOS simulator.

This is what the Readme says about fixing common issues:

  • Error: App does not build after adding Share Extension?
  • Fix: Check Build Settings of your share extension and remove everything that tries to import Cocoapods from your main project. i.e. remove everything under Linking/Other Linker Flags
  • You might need to disable bitcode for the extension target

I don't have Other Linker Flags. Also bitcode is not enabled (in Runner target, that's the only place where I can see this option).

I have also tried:

rm ios/Podfile flutter pub upgrade flutter pub get cd ios && pod update flutter clean && flutter run

Here's what the debug console looks like when trying to run from vs code:

Launching lib/main.dart on iPhone 13 in debug mode... lib/main.dart:1 Xcode build done. 24.0s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/DKImagePickerController/DKImagePickerController.framework/DKImagePickerController ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/DKPhotoGallery/DKPhotoGallery.framework/DKPhotoGallery ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/PromisesObjC/FBLPromises.framework/FBLPromises ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FMDB/FMDB.framework/FMDB ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseAuth/FirebaseAuth.framework/FirebaseAuth ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseCore/FirebaseCore.framework/FirebaseCore ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseCoreDiagnostics/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseDynamicLinks/FirebaseDynamicLinks.framework/FirebaseDynamicLinks ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseFirestore/FirebaseFirestore.framework/FirebaseFirestore ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseInstallations/FirebaseInstallations.framework/FirebaseInstallations ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseMessaging/FirebaseMessaging.framework/FirebaseMessaging ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/FirebaseStorage/FirebaseStorage.framework/FirebaseStorage ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/GTMSessionFetcher/GTMSessionFetcher.framework/GTMSessionFetcher ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/GoogleDataTransport/GoogleDataTransport.framework/GoogleDataTransport ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/GoogleUtilities/GoogleUtilities.framework/GoogleUtilities ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/SDWebImage/SDWebImage.framework/SDWebImage ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/SwiftyGif/SwiftyGif.framework/SwiftyGif ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/abseil/absl.framework/absl ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/file_picker/file_picker.framework/file_picker ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/flutter_exif_rotation/flutter_exif_rotation.framework/flutter_exif_rotation ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/flutter_local_notifications/flutter_local_notifications.framework/flutter_local_notifications ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/gallery_saver/gallery_saver.framework/gallery_saver ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/gRPC-Core/grpc.framework/grpc ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/gRPC-C++/grpcpp.framework/grpcpp ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/heic_to_jpg/heic_to_jpg.framework/heic_to_jpg ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/image_picker/image_picker.framework/image_picker ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/leveldb-library/leveldb.framework/leveldb ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/maps_launcher/maps_launcher.framework/maps_launcher ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/nanopb/nanopb.framework/nanopb ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/BoringSSL-GRPC/openssl_grpc.framework/openssl_grpc ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/path_provider_ios/path_provider_ios.framework/path_provider_ios ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/receive_sharing_intent/receive_sharing_intent.framework/receive_sharing_intent ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/share_plus/share_plus.framework/share_plus ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/shared_preferences_ios/shared_preferences_ios.framework/shared_preferences_ios ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/sqflite/sqflite.framework/sqflite ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/mac/Desktop/Development/Playground/piccy/build/ios/Debug-iphonesimulator/url_launcher_ios/url_launcher_ios.framework/url_launcher_ios ld: warning: Could not find or use auto-linked framework 'Flutter' Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_FlutterStandardTypedData", referenced from: objc-class-ref in firebase_storage(FLTFirebaseStoragePlugin.o) "_OBJC_METACLASS_$_FlutterStandardWriter", referenced from: _OBJC_METACLASS_$_FLTFirebaseFirestoreWriter in cloud_firestore(FLTFirebaseFirestoreWriter.o) "_FlutterMethodNotImplemented", referenced from: -[FLTFirebaseFirestorePlugin handleMethodCall:result:] in cloud_firestore(FLTFirebaseFirestorePlugin.o) -[FLTFirebaseAuthPlugin handleMethodCall:result:] in firebase_auth(FLTFirebaseAuthPlugin.o) -[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) -[FLTFirebaseStoragePlugin handleMethodCall:result:] in firebase_storage(FLTFirebaseStoragePlugin.o) "_OBJC_CLASS_$_FlutterEventChannel", referenced from: objc-class-ref in cloud_firestore(FLTFirebaseFirestorePlugin.o) objc-class-ref in firebase_auth(FLTFirebaseAuthPlugin.o) "_FlutterEndOfEventStream", referenced from: ___63-[FLTTransactionStreamHandler onListenWithArguments:eventSink:]_block_invoke.104 in cloud_firestore(FLTTransactionStreamHandler.o) "_OBJC_METACLASS_$_FlutterStandardReaderWriter", referenced from: _OBJC_METACLASS_$_FLTFirebaseFirestoreReaderWriter in cloud_firestore(FLTFirebaseFirestoreUtils.o) "_OBJC_CLASS_$_FlutterStandardReaderWriter", referenced from: _OBJC_CLASS_$_FLTFirebaseFirestoreReaderWriter in cloud_firestore(FLTFirebaseFirestoreUtils.o) "_OBJC_CLASS_$_FlutterStandardWriter", referenced from: _OBJC_CLASS_$_FLTFirebaseFirestoreWriter in cloud_firestore(FLTFirebaseFirestoreWriter.o) "_OBJC_METACLASS_$_FlutterStandardReader", referenced from: _OBJC_METACLASS_$_FLTFirebaseFirestoreReader in cloud_firestore(FLTFirebaseFirestoreReader.o) "_OBJC_CLASS_$_FlutterStandardReader", referenced from: _OBJC_CLASS_$_FLTFirebaseFirestoreReader in cloud_firestore(FLTFirebaseFirestoreReader.o) "_OBJC_CLASS_$_FlutterError", referenced from: objc-class-ref in cloud_firestore(FLTQuerySnapshotStreamHandler.o) objc-class-ref in firebase_core(FLTFirebasePlugin.o) "_OBJC_CLASS_$_FlutterMethodChannel", referenced from: objc-class-ref in cloud_firestore(FLTFirebaseFirestorePlugin.o) objc-class-ref in firebase_auth(FLTFirebaseAuthPlugin.o) 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) objc-class-ref in firebase_storage(FLTFirebaseStoragePlugin.o) "_OBJC_CLASS_$_FlutterStandardMethodCodec", referenced from: objc-class-ref in cloud_firestore(FLTFirebaseFirestorePlugin.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) note: Using new build system note: Planning note: Build preparation complete note: Building targets in parallel /Users/mac/Desktop/Development/Playground/piccy/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'FMDB' from project 'Pods') /Users/mac/Desktop/Development/Playground/piccy/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'leveldb-library' from project 'Pods') /Users/mac/Desktop/Development/Playground/piccy/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'abseil' from project 'Pods') /Users/mac/Desktop/Development/Playground/piccy/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'BoringSSL-GRPC' from project 'Pods') /Users/mac/Desktop/Development/Playground/piccy/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'gRPC-Core' from project 'Pods') /Users/mac/Desktop/Development/Playground/piccy/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods') /Users/mac/Desktop/Development/Playground/piccy/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'gRPC-C++' from project 'Pods') Could not build the application for the simulator. Error launching application on iPhone 13. Exited (sigterm)

Here is some output when I try to run on a physical device in XCode:

Showing Recent Messages Could not find or use auto-linked framework 'Flutter' Undefined symbol: _OBJC_CLASS_$_FlutterStandardTypedData Undefined symbol: _OBJC_METACLASS_$_FlutterStandardWriter Undefined symbol: _FlutterMethodNotImplemented Undefined symbol: _OBJC_CLASS_$_FlutterEventChannel Undefined symbol: _FlutterEndOfEventStream Undefined symbol: _OBJC_METACLASS_$_FlutterStandardReaderWriter Undefined symbol: _OBJC_CLASS_$_FlutterStandardReaderWriter Undefined symbol: _OBJC_CLASS_$_FlutterStandardWriter Undefined symbol: _OBJC_METACLASS_$_FlutterStandardReader Undefined symbol: _OBJC_CLASS_$_FlutterStandardReader Undefined symbol: _OBJC_CLASS_$_FlutterError Undefined symbol: _OBJC_CLASS_$_FlutterMethodChannel Undefined symbol: _OBJC_CLASS_$_FlutterStandardMethodCodec

These XCode errors can also be found in the vs code debug log, although formatted slightly differently. Any idea how to fix this?

Any help would be greatly appreciated!

rensvis commented 2 years ago

So after having spent three days trying to figure out why my build kept failing over and over, I have now figured it out.

I mentioned I was not able to find any Other Linker Flags in my Share Extension under build settings. Turns out the options were filtered so I wasn't seeing it. When pressing 'All' in the filters menu bar I did see this setting and was able to adjust it.

To delete the Other Linker Flags, do the following:

  1. In XCode, go to Runner
  2. Under Targets select your Share Extension
  3. In the settings screen navigate to the Build Settings tab
  4. Make sure your filter is set to 'All'
  5. Scroll down to Linking
  6. Find the Other Linker Flags row
  7. Doubleclick on the value
  8. A popup window will appear with all the records. Select multiple by using Shift and hit the minus (-) icon in the bottom of the window to delete them
  9. Run flutter build ios