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

fix: addApplicationDelegate unavailable in iOS #228

Merged
merged 4 commits into from Mar 21, 2024

Conversation

armandsLa
Copy link
Contributor

@armandsLa armandsLa commented Feb 28, 2024

I'm proposing a simple fix to avoid errors caused by NS_EXTENSION_UNAVAILABLE_IOS when adding home_widget to the widget target. This fix uses performSelector to bypass the NS_EXTENSION_UNAVAILABLE_IOS macro. It might not be ideal, but it works and is very simple.

@ABausG
Copy link
Owner

ABausG commented Feb 29, 2024

Ooh! This looks very nice. I tried to work around this by using some @available annotations but those seem to not correctly check at runtime. Will have closer look later today!

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (cba8262) to head (dd044da).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #228   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           73        73           
=========================================
  Hits            73        73           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ABausG ABausG changed the title Fix addApplicationDelegate on iOS fix: addApplicationDelegate unavailable in iOS Mar 5, 2024
Copy link
Owner

@ABausG ABausG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this!

I'd love to hear some more reasoning about your approach in comparison to an available check. Mostly to learn a bit more about iOS!

Also could you possibly add the pod spec adjustments needed for Interactivity to the example pod file? I noticed that this way the Integration Test Would fail without adjustments so it would be a great check

target 'YourWidgetExtension' do
   use_frameworks!
   use_modular_headers!

   pod 'home_widget', :path => '.symlinks/plugins/home_widget/ios'
end

ios/Classes/SwiftHomeWidgetPlugin.swift Show resolved Hide resolved
ios/Classes/SwiftHomeWidgetPlugin.swift Show resolved Hide resolved
@ABausG
Copy link
Owner

ABausG commented Mar 11, 2024

@armandsLa Do you still have time to finish this off?

@armandsLa
Copy link
Contributor Author

armandsLa commented Mar 15, 2024

Sorry for the late response, I've been very busy lately.

I've made changes to the Podfile as requested. I moved every target to the root level and added the necessary configurations. Previously, the targets were nested, which I had never seen before. Usually, every target is at the root level, and optionally, a shared_pods method is defined to keep everything DRY. In this case, it was not necessary, though.

@ABausG
Copy link
Owner

ABausG commented Mar 21, 2024

Had to make some adjustments to the Podfile in order to have integration tests pass. The nesting seems to be important to work correctly. Given that the RunnerTest nesting is also done by the default Flutter Project I feel this is fine. Most important thing the tests are passing again

@ABausG ABausG merged commit b3b9dd9 into ABausG:main Mar 21, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants