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(connectivity_plus)!: Bump min iOS to 12 to support XCode 15 #2169

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

vbuberen
Copy link
Collaborator

@vbuberen vbuberen commented Sep 30, 2023

Description

We have multiple bug reports about issues when connectivity_plus plugin is used in a project build with Xcode 15. Apparently, after some investigation found out that Xcode 15 supports only iOS 12 and newer and not all APIs work fine.
Here is an example of similar solution: https://stackoverflow.com/a/77151438/7339798
In order to support Xcode 15 I am bumping min iOS version for the plugin to 12, so users won't have to modify their build configs on iOS.
Marking as a breaking change to be sure I don't break projects for somebody who still supports <12 iOS versions.

Related Issues

Supposed to close quite a lot of issues:

Fixes #1955
Fixes #2136
Fixes #2154
Fixes #2155
Fixes #2159
Fixes #2162
Fixes #2166
Fixes #2152

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

@vbuberen vbuberen added the connectivity_plus Connectivity Plus label Sep 30, 2023
@vbuberen vbuberen requested a review from nohli September 30, 2023 12:21
Copy link
Member

@nohli nohli left a comment

Choose a reason for hiding this comment

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

Oh boi, quite a few issues you've found 🙏🏽

@vbuberen
Copy link
Collaborator Author

I will wait for a confirmation from one of the users with this problem as I currently don't have a physical iOS device to check the fix.

@vbuberen
Copy link
Collaborator Author

vbuberen commented Oct 2, 2023

Ok, we have a first confirmation: #2155 (comment)

Thus, merging to release plugins somewhere this week.

@vbuberen vbuberen merged commit cf7d93f into main Oct 2, 2023
20 checks passed
@vbuberen vbuberen deleted the update/connectivity_plus_min_ios branch October 2, 2023 10:14
@NamanShergill
Copy link

NamanShergill commented Oct 3, 2023

@vbuberen Directly using this ref is not working either, it's failing at this part still

image

@NamanShergill
Copy link

Not really familiar with Xcode so not sure where to find the relevant logs to attach, please let me know if I need to send anything specific

@NamanShergill
Copy link

NamanShergill commented Oct 3, 2023

Flutter version: 3.13.6
Xcode version: 15.0
Device OS: iPadOS 16.3 (20D47)

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x0000000000000000 in 0x00000000 ()
#1	0x00000001005b5400 in PathMonitorConnectivityProvider.ensurePathMonitor() at /Users/naman/.pub-cache/git/plus_plugins-cf7d93fbfc76830acf2db755543cf4235a49df60/packages/connectivity_plus/connectivity_plus/ios/Classes/PathMonitorConnectivityProvider.swift:49
#2	0x00000001005b5238 in PathMonitorConnectivityProvider.init() at /Users/naman/.pub-cache/git/plus_plugins-cf7d93fbfc76830acf2db755543cf4235a49df60/packages/connectivity_plus/connectivity_plus/ios/Classes/PathMonitorConnectivityProvider.swift:34
#3	0x00000001005b5280 in @objc PathMonitorConnectivityProvider.init() ()
#4	0x00000001005b50c8 in PathMonitorConnectivityProvider.__allocating_init() ()
#5	0x00000001005b6d28 in static SwiftConnectivityPlusPlugin.register(with:) at /Users/naman/.pub-cache/git/plus_plugins-cf7d93fbfc76830acf2db755543cf4235a49df60/packages/connectivity_plus/connectivity_plus/ios/Classes/SwiftConnectivityPlusPlugin.swift:28
#6	0x00000001005b7004 in @objc static SwiftConnectivityPlusPlugin.register(with:) ()
#7	0x00000001005b4048 in +[ConnectivityPlusPlugin registerWithRegistrar:] at /Users/naman/.pub-cache/git/plus_plugins-cf7d93fbfc76830acf2db755543cf4235a49df60/packages/connectivity_plus/connectivity_plus/ios/Classes/ConnectivityPlusPlugin.m:13
#8	0x000000010010c074 in +[GeneratedPluginRegistrant registerWithRegistry:] at /proj/ios/Runner/GeneratedPluginRegistrant.m:96
#9	0x000000010010c46c in AppDelegate.application(_:didFinishLaunchingWithOptions:) at /proj/ios/Runner/AppDelegate.swift:10
#10	0x000000010010c75c in @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) ()
#11	0x00000001acbeea50 in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#12	0x00000001acbee174 in -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] ()
#13	0x00000001acbed150 in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#14	0x00000001acbecd9c in -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] ()
#15	0x00000001ac932e74 in _UIScenePerformActionsWithLifecycleActionMask ()
#16	0x00000001acc74d78 in __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke ()
#17	0x00000001acb25adc in -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] ()
#18	0x00000001acb25904 in -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] ()
#19	0x00000001acb254b4 in -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] ()
#20	0x00000001acb25380 in __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke ()
#21	0x00000001ad20956c in +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] ()
#22	0x00000001ad2a3568 in _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion ()
#23	0x00000001ac9d1374 in -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] ()
#24	0x00000001ace44294 in __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.214 ()
#25	0x00000001acaa39a0 in -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] ()
#26	0x00000001acaa3810 in -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] ()
#27	0x00000001acaa2d64 in -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] ()
#28	0x00000001acaa2af0 in -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] ()
#29	0x00000001c0438e90 in -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] ()
#30	0x00000001c04788f8 in __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.78 ()
#31	0x00000001c043cc24 in -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] ()
#32	0x00000001c0478530 in __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke ()
#33	0x00000001007e5ff0 in _dispatch_client_callout ()
#34	0x00000001007e9a6c in _dispatch_block_invoke_direct ()
#35	0x00000001c0446d40 in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ ()
#36	0x00000001c04468dc in -[FBSSerialQueue _targetQueue_performNextIfPossible] ()
#37	0x00000001c0449184 in -[FBSSerialQueue _performNextFromRunLoopSource] ()
#38	0x00000001aa795f24 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#39	0x00000001aa7a22fc in __CFRunLoopDoSource0 ()
#40	0x00000001aa726220 in __CFRunLoopDoSources0 ()
#41	0x00000001aa73bb7c in __CFRunLoopRun ()
#42	0x00000001aa740eb0 in CFRunLoopRunSpecific ()
#43	0x00000001e4088368 in GSEventRunModal ()
#44	0x00000001acc36668 in -[UIApplication _run] ()
#45	0x00000001acc362cc in UIApplicationMain ()
#46	0x000000010010c8d4 in main at /proj/ios/Runner/AppDelegate.swift:5
#47	0x00000001c902c960 in start ()

@vbuberen
Copy link
Collaborator Author

vbuberen commented Oct 3, 2023

Are you sure you use the patched version? I had confirmation from other people as well that patch worked

@NamanShergill
Copy link

NamanShergill commented Oct 3, 2023

@vbuberen yes, you can see the commit ref in this part of the error, in the path:

#1	0x00000001005b5400 in PathMonitorConnectivityProvider.ensurePathMonitor() at /Users/naman/.pub-cache/git/plus_plugins-cf7d93fbfc76830acf2db755543cf4235a49df60/packages/connectivity_plus/connectivity_plus/ios/Classes/PathMonitorConnectivityProvider.swift:49

@NamanShergill
Copy link

NamanShergill commented Oct 3, 2023

@vbuberen I was about to update to iPadOS 17 before I ran into this, however considering this issue is happening only on physical devices, should I stay on 16.3 to verify any fixes or provide any logs that might be needed?

@vbuberen
Copy link
Collaborator Author

vbuberen commented Oct 3, 2023

I was about to update to iPadOS 17 before I ran into this, however considering this issue is happening only on physical devices, should I stay on 16.3 to verify any fixes or provide any logs that might be needed?

Thank you for such suggestion. What I would ask you to do is to open a new issue where we can continue the discussion. Also, would be great if you provide me with some details of iOS part of your project, like iOS deployment target in that issue.

As to updating to iOS 17 or not - if it is Ok for you, please don't update, so we could validate that the fix work if it turns out the problem only happens on iOS 16 (which I doubt and believe that the problem is in the Xcode 15 itself).

@NamanShergill
Copy link

NamanShergill commented Oct 3, 2023

As to updating to iOS 17 or not - if it is Ok for you, please don't update, so we could validate that the fix work if it turns out the problem only happens on iOS 16 (which I doubt and believe that the problem is in the Xcode 15 itself).

I am able to build the project just fine on my iPhone which is on iOS 17 using Xcode 15. It's happening just on iPadOS 16.3 for me right now. I won't update my iPad for now in case it actually is a <iOS 17 problem.

Also, would be great if you provide me with some details of iOS part of your project, like iOS deployment target in that issue.

Will open a new issue with the details in a few mins, would be including the process I used to build for both min 11.0 target and 12.0, anything else you need me to include?

@NamanShergill
Copy link

NamanShergill commented Oct 3, 2023

@vbuberen I was able to get it to work, it wasn't an issue with the plugin, for some reason Xcode was resetting the pod's minimum target to 11, even if the plugin now specifies 12, and it did it for the example project as well (I changed the ref to this fix).

Once I saw that, manually setting it back to 12 in the Xcode UI itself, fixed the issue. (I checked the bundled plist of the plugin, it was still saying 12 even before I changed it, but it was 11 in Xcode.)

I am not sure why it Is was doing that but the plugin is working fine, it was an issue with XCode, reinstalling it fixed the problem.

@NamanShergill
Copy link

if it turns out the problem only happens on iOS 16 (which I doubt and believe that the problem is in the Xcode 15 itself).

This turned out to be the case after all

@vbuberen
Copy link
Collaborator Author

vbuberen commented Oct 3, 2023

Thank you for researching and providing feedback. It was really helpful.

r10s added a commit to deltachat/deltachat-ios that referenced this pull request Oct 7, 2023
this is needed as otherwise there are weird crashes,
eg. when opening connectivity view
(there are sth. simple as `let monitor = NWPathMonitor()`)

as reported eg. at
fluttercommunity/plus_plugins#2169
it seems xcode15 does not support ios<12 fully

fortunately,
this does not change our minimum supported devices as
all of them get get ios12.
r10s added a commit to deltachat/deltachat-ios that referenced this pull request Oct 7, 2023
this is needed as otherwise there are weird crashes,
eg. when opening connectivity view
(there are sth. simple as `let monitor = NWPathMonitor()`)

as reported eg. at
fluttercommunity/plus_plugins#2169
it seems xcode15 does not support ios<12 fully

fortunately,
this does not change our minimum supported devices as
all of them get get ios12.
@vbuberen vbuberen mentioned this pull request Oct 11, 2023
7 tasks
@niypoo
Copy link

niypoo commented Oct 18, 2023

As to updating to iOS 17 or not - if it is Ok for you, please don't update, so we could validate that the fix work if it turns out the problem only happens on iOS 16 (which I doubt and believe that the problem is in the Xcode 15 itself).

I am able to build the project just fine on my iPhone which is on iOS 17 using Xcode 15. It's happening just on iPadOS 16.3 for me right now. I won't update my iPad for now in case it actually is a <iOS 17 problem.

Also, would be great if you provide me with some details of iOS part of your project, like iOS deployment target in that issue.

Will open a new issue with the details in a few mins, would be including the process I used to build for both min 11.0 target and 12.0, anything else you need me to include?

Thanks , you saved my day 👏

@marianhlavac
Copy link

Info for those arriving to this PR when Googling:

The issue is confirmed when building for iOS <17, active issue is here #2276

@ueman
Copy link
Contributor

ueman commented Dec 15, 2023

I get a

Compiling for iOS 12.0, but module 'Reachability' has a minimum deployment target of iOS 12.4

error now. Xcode still supports iOS 12.0 though. Is the 12.4 requirement intentional?

@vbuberen
Copy link
Collaborator Author

vbuberen commented Dec 15, 2023

No, it is not required. We already had that issue with Reachability pod some time ago. It is not the plugin, but something else with Cocoapods.

@vbuberen
Copy link
Collaborator Author

You have Reachability pod updated locally due to some other dependency, I guess.
Check out this comment, for example
pusher/pusher-websocket-swift#235 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment