[Bug]: connectivity_plus crashes when running on real IOS device
Platform
IOS 16.6.1
Plugin
connectivity_plus
Version
4.0.2
Flutter SDK
3.13.5
Steps to reproduce
-
Create new Flutter project in VS-Code ('empty flutter project'). Code attached is unchanged from the template project
-
Run project on real IOS device (iPhone 13 pro in m case). Output:
Launching lib/main.dart on ... in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: XXX Xcode build done. (lldb) 2023-09-21 22:53:07.512889+0100 Runner[853:88338] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(37)] Using the Impeller rendering backend. Connecting to VM Service at ws://127.0.0.1:64855/EZy9MDloE_s=/ws
-
install connectivity_plus (flutter pub add connectivity_plus)
-
Re-run project. Output:
Xcode build done. (lldb) 2023-09-21 22:56:21.599196+0100 Runner[858:90229] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(37)] Using the Impeller rendering backend. thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x0000000000000000 error: memory read failed for 0x0 Target 0: (Runner) stopped. Error launching application on device.
Code Sample
import 'package:flutter/material.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: Text('Hello World!'),
),
),
);
}
}
Logs
Log too long to be attached
Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.5, on macOS 13.5.2 22G91 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.82.1)
[✓] Connected device (3 available)
[✓] Network resources
Checklist before submitting a bug
- [X] I Google'd a solution and I couldn't find it
- [X] I searched on StackOverflow for a solution and I couldn't find it
- [X] I read the README.md file of the plugin
- [X] I'm using the latest version of the plugin
- [X] All dependencies are up to date with
flutter pub upgrade - [X] I did a
flutter clean - [X] I tried running the example project
same for me
''' @discardableResult private func ensurePathMonitor() -> NWPathMonitor { if (_pathMonitor == nil) { let pathMonitor = NWPathMonitor() // 《= Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) pathMonitor.start(queue: queue) pathMonitor.pathUpdateHandler = pathUpdateHandler _pathMonitor = pathMonitor } return _pathMonitor! } '''
![Screenshot 2023-09-22 at 11 40 51 AM (2)]
Same issue
Same for me.It's quite normal last time I used it.
https://github.com/fluttercommunity/plus_plugins/issues/2154
It's a useful way to solve this problem temporarily.
Unfortunately, don't have real iOS device available, so can't check and fix it. Would appreciate somebody taking care of it and opening a PR.
It seems 4.0.2 works on ios 17, but crashes on earlier versions.
Same, only works on IOS 17
App crash with iOS16.X I made the the test after upgrading to iOS17 and it works.
Crashes for me as well 16.6.1
Hi guys, I managed to fix this issue by modifying Podfile as follows:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
After remove IPHONEOS_DEPLOYMENT_TARGET, all pods deploy target will be the same as main project. In my case, it's 'ios 13'. After that it works well in 16.6.1. The crash point is here:
" if #available(iOS 12, *) {
connectivityProvider = PathMonitorConnectivityProvider()
} else {
connectivityProvider = ReachabilityConnectivityProvider()
}"
Not quite sure about the root cause, anyone can help explain here.
My code needed 2 changes, one for this plugin, one for the new Flutter version (i think)
platform :ios, '13.0'
....
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
#https://github.com/fluttercommunity/plus_plugins/issues/2154#issuecomment-1730330223
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
#https://stackoverflow.com/a/77134628/5734049
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
end
end }
+1 on iPhone SE running iOS 15.7.9 and Flutter 3.13.0
+1 on iPhone 6s running iOS 15.7.7 and Flutter 3.13.6
The app crashes when building using Xcode 15 on my mac. When building in the CI pipeline using Xcode 14.2 and fastlane the app does not crash.
+1 iOS 15.5 and Flutter 3.13.6
https://github.com/fluttercommunity/plus_plugins/issues/2154 this one worked for me
I encourage everyone to try the fix from #2169 to let me know that I can merge and release an update for connectivity_plus.
To do so, declare the plugin the following way:
connectivity_plus:
git:
url: https://github.com/fluttercommunity/plus_plugins.git
path: packages/connectivity_plus/connectivity_plus
ref: cf7d93fbfc76830acf2db755543cf4235a49df60
UPD (Oct 3 2023): Because the PR with the fix is already merged updated the snippet to point to exact commit with the fix on main branch. Till the new version of connectivity_plus released this week, it is advised to use the version from the snippet.
I encourage everyone to try the fix from #2169 to let me know that I can merge and release an update for
connectivity_plus.To do so, declare the plugin the following way:
connectivity_plus: git: url: [email protected]:fluttercommunity/plus_plugins.git path: packages/connectivity_plus/connectivity_plus ref: update/connectivity_plus_min_ios
This is working for me
but i changed url: [email protected]:fluttercommunity/plus_plugins.git to https://github.com/fluttercommunity/plus_plugins.git to be able to download it
Thank you very much for your feedback and for the fix of the link. I will merge the PR and will try to release updates for plugins this week.
when do you update new version? @vbuberen
Read the message above