Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Compiler Error (Xcode): 'addApplicationDelegate' is unavailable in application extensions for iOS #201

Closed
ThuyenPV opened this issue Jan 8, 2024 · 10 comments

Comments

@ThuyenPV
Copy link

ThuyenPV commented Jan 8, 2024

Could not build the precompiled application for the device. Swift Compiler Error (Xcode): 'addApplicationDelegate' is unavailable in application extensions for iOS: Disallowed in plugins used in app extensions /Users/thupv2/thupv/research/home_widget/ios/Classes/SwiftHomeWidget Plugin.swift:32:14 Error launching application on Thuyen Pham Iphone.

@rohanots
Copy link

Getting the same issue. Any fix yet?
image

@ABausG
Copy link
Owner

ABausG commented Jan 23, 2024

Can you please let me know some Infos:

  • Flutter Doctor Output
  • XCode Version
  • iOS Deployment Versions

@gaucidaniel
Copy link

gaucidaniel commented Jan 23, 2024

Having the same issue as @rohanots & @ThuyenPV:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.2.1 23C71 darwin-arm64, locale en-MT)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.85.2)
[✓] Connected device (4 available)            
[✓] Network resources

• No issues found!

@ABausG there was a very similar issue on awesome_notifications which might be helpful: https://github.com/rafaelsetragni/awesome_notifications/issues/893

@ABausG
Copy link
Owner

ABausG commented Jan 24, 2024

Update on this: Found the culprit and noticed this happens when adding interactivity to iOS Widgets (and including the Library in the Pods for the Extension)

I am working on a fix for this

@armandsLa
Copy link
Contributor

armandsLa commented Feb 1, 2024

Running into same issue. Replacing pod 'home_widget', :path => '.symlinks/plugins/home_widget/ios' with inherit! :search_paths in Podfile seems to fix the issue.

@ataberkw
Copy link

Running into same issue. Replacing pod 'home_widget', :path => '.symlinks/plugins/home_widget/ios' with inherit! :search_paths in Podfile seems to fix the issue.

This does not fixes the issue. As the author mentioned, adding interactivity is the culprit. When you apply your workaround, you won't be able to import home_widget. This is just a workaround for people don't want to use interactivity. Not a fix.

@armandsLa
Copy link
Contributor

armandsLa commented Feb 14, 2024

It's a workaround, yes, but it allows you to import the home_widget and implement interactivity. I've just done that in my app without any issues. If interactivity is not needed, then there is no reason to include home_widget in your extension target at all.

@armandsLa
Copy link
Contributor

Inheriting search paths worked fine until it didn't. I've created a PR with a fix that allows importing home_widget in widget extension. Feel free to use my branch until this or other fix gets merged.

PR: #228

@ataberkw
Copy link

ataberkw commented Mar 11, 2024

It's a workaround, yes, but it allows you to import the home_widget and implement interactivity. I've just done that in my app without any issues. If interactivity is not needed, then there is no reason to include home_widget in your extension target at all.

You were right, I'm sorry. I guess I confused something because I tried to apply tons of workaround to fix this issue. I'm using your workaround and isSetupCompleted = true; patch in setupEngine for 2 weeks without a problem. Also thanks for your efforts on pull request.

Now I realized you made pull request for [ignoreSetup] too. (#219 (comment)) 🚀🚀🚀

@ABausG
Copy link
Owner

ABausG commented Mar 24, 2024

Fixed in Version 0.5.0

@ABausG ABausG closed this as completed Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants