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
334 stars 396 forks source link

iOS Build Fails with Linker Errors #289

Closed linoy18 closed 7 months ago

linoy18 commented 7 months ago

## Environment (Note: I've also tried with Xcode version 14.0.)

Flutter version: 3.19.5 receive_sharing_intent version: 1.6.8 (I also tried version 1.6.7.) iOS version: 13.0 Xcode version: 15.2

Description

When integrating receive_sharing_intent into my Flutter project, the iOS build fails with multiple linker errors related to CoreAudioTypes, Flutter, and undefined symbols for architecture x86_64. This issue persists despite following all the suggested steps in the documentation and attempting several troubleshooting steps.

## Steps to Reproduce

Add receive_sharing_intent to pubspec.yaml and run flutter pub get. Follow the setup instructions for iOS as per the package documentation. Attempt to build the project for iOS.

The build fails with the following errors:

ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found ld: warning: Could not find or use auto-linked framework 'Flutter': framework 'Flutter' not found Undefined symbols for architecture x86_64: "_FlutterMethodNotImplemented", referenced from: receive_sharingintent.SwiftReceiveSharingIntentPlugin.handle(: C.FlutterMethodCall, result: (Any?) -> ()) -> () in receive_sharing_intent[x86_64]6 receive_sharingintent.SwiftReceiveSharingIntentPlugin.handle(: C.FlutterMethodCall, result: (Any?) -> ()) -> () in receive_sharing_intent[x86_64]6 "_OBJCCLASS$_FlutterEventChannel", referenced from: in receive_sharing_intent[x86_64]6 "_OBJCCLASS$_FlutterMethodChannel", referenced from: in receive_sharing_intent[x86_64]6 ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

## Troubleshooting Steps Attempted

  1. Ensured all setup steps in the package documentation were correctly followed.
  2. Deleted the "Other Linker Flags" in the build settings of the share extension.
  3. Changed the target iOS version to the same values.
  4. Ran flutter clean, flutter pub get, and pod install after making changes (also cleaned the folder under Product before building).
  5. Upgraded the package to version 1.6.8. And perhaps more that I don't remember. I have been trying for a few days and have read all related issues here.

I would like to mention that it worked at the beginning of the week. I didn't change anything, and then it stopped working. The only difference was that I added signing details correctly, and all errors under "Signing & Capabilities" were resolved, and maybe I ran pod install again. Then, these errors showed up. I even deleted everything and tried a new project again on different Macs, and it also showed me the same error.

None of these steps resolved the build issues.

Any help or guidance would be greatly appreciated.

linoy18 commented 7 months ago

@KasemJaffer

linoy18 commented 7 months ago

Hi everyone,

I wanted to update this issue with the solution that worked for me, in case it helps anyone else facing a similar problem. After spending 5 days on this, I've finally resolved the issue with the following change in the Podfile:

Original Configuration: target 'Runner' do pod ... use_frameworks! :linkage => :static end Updated Configuration:

target 'Runner' do pod ... use_frameworks! end

The key was to remove :linkage => :static from the use_frameworks! directive. I'm closing this issue now, but I hope this solution helps anyone who encounters the same problem.