plus_plugins
plus_plugins copied to clipboard
[Bug]: onConnectivityChanged - iOS not showing when WiFi is not available
Platform
iOS 16.4 simulator
Plugin
connectivity_plus
Version
^4.0.2
Flutter SDK
3.10.6
Steps to reproduce
- Run App with WiFi turned on
- Turn off WiFi
-
onConnectivityChanged
still shows 'wifi' instead of 'none' for internet connection
But if you do the following it works ok but will break again:
Run the App with WiFi turned off Turn on the WiFi on Mac (it works) Turn off the WifFi on Mac onConnectivityChanged still shows 'wifi' instead of 'none' for internet connection
Code Sample
connectionService.connectivity.onConnectivityChanged
.listen((connectivityResult) {
debugPrint('connectivityResult: ${connectivityResult.name}');
});
By the way, when you run it on an actual iPhone device it looks like it's working fine.
### Logs
```shell
Users/marco/StudioProjects/simpsons_viewer/build/ios/iphonesimulator/Runner.app
[ +255 ms] executing: /usr/bin/plutil -convert xml1 -o -
/Users/marco/StudioProjects/simpsons_viewer/build/ios/iphonesimulator/Runner.app/Info.plist
[ +4 ms] Exit code 0 from: /usr/bin/plutil -convert xml1 -o -
/Users/marco/StudioProjects/simpsons_viewer/build/ios/iphonesimulator/Runner.app/Info.plist
[ ] <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>22G74</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Simpsons Viewer</string>
<key>CFBundleExecutable</key>
<string>Runner</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
</array>
<key>CFBundleIconName</key>
<string>AppIcon</string>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
<string>AppIcon76x76</string>
</array>
<key>CFBundleIconName</key>
<string>AppIcon</string>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>com.sample.simpsonsviewer</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>simpsons_viewer</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneSimulator</string>
</array>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>20E238</string>
<key>DTPlatformName</key>
<string>iphonesimulator</string>
<key>DTPlatformVersion</key>
<string>16.4</string>
<key>DTSDKBuild</key>
<string>20E238</string>
<key>DTSDKName</key>
<string>iphonesimulator16.4</string>
<key>DTXcode</key>
<string>1431</string>
<key>DTXcodeBuild</key>
<string>14E300c</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>11.0</string>
<key>NSBonjourServices</key>
<array>
<string>_dartVmService._tcp</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Allow Flutter tools on your computer to connect and debug your application. This prompt
will not appear on release builds.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
[ +6 ms] executing: /usr/bin/arch -arm64e xcrun simctl launch A74D8B76-F676-4449-8598-4230B4D1A65B
com.sample.simpsonsviewer --enable-dart-profiling --enable-checked-mode --verify-entry-points
[ +98 ms] com.sample.simpsonsviewer: 1039
[ ] Waiting for VM Service port to be available...
[ +63 ms] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(35)] Using the Impeller rendering backend.
[ +30 ms] VM Service URL on device: http://127.0.0.1:54033/SyKrBshV03c=/
[ +2 ms] Caching compiled dill
[ +14 ms] Connecting to service protocol: http://127.0.0.1:54033/SyKrBshV03c=/
[ +59 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service
at http://127.0.0.1:54033/SyKrBshV03c=/.
[ +28 ms] DDS is listening at http://127.0.0.1:54036/iybTqMuHL4o=/.
[ +21 ms] Successfully connected to service protocol: http://127.0.0.1:54033/SyKrBshV03c=/
[ +9 ms] DevFS: Creating new filesystem on the device (null)
[ +5 ms] DevFS: Created new filesystem on the device
(file:///Users/marco/Library/Developer/CoreSimulator/Devices/A74D8B76-F676-4449-8598-4230B4D1A65B/data/Contai
ners/Data/Application/8A702AA2-7716-4DD0-94BC-444BA532D644/tmp/simpsons_viewerMmfsnv/simpsons_viewer/)
[ ] Updating assets
[ +39 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for
more information see #56466.
[ +1 ms] Syncing files to device iPhone 14 Pro Max...
[ ] Compiling dart to kernel with 0 updated files
[ ] Processing bundle.
[ ] <- recompile package:simpsons_viewer/main.dart 8fa36b65-3e47-44b4-b49e-28cbd92cdba2
[ ] <- 8fa36b65-3e47-44b4-b49e-28cbd92cdba2
[ ] Bundle processing done.
[ +39 ms] Updating files.
[ ] DevFS: Sync finished
[ ] Syncing files to device iPhone 14 Pro Max... (completed in 41ms)
[ ] Synced 0.0MB.
[ ] <- accept
[ +1 ms] Connected to _flutterView/0x136059220.
[ ] Flutter run key commands.
[ ] r Hot reload. 🔥🔥🔥
[ ] R Hot restart.
[ ] h List all available interactive commands.
[ ] d Detach (terminate "flutter run" but leave application running).
[ ] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ ] A Dart VM Service on iPhone 14 Pro Max is available at: http://127.0.0.1:54036/iybTqMuHL4o=/
[ +99 ms] flutter: connectivityResult: none
[ +2 ms] The Flutter DevTools debugger and profiler on iPhone 14 Pro Max is available at:
http://127.0.0.1:9100?uri=http://127.0.0.1:54036/iybTqMuHL4o=/
[+43048 ms] Application finished.
### Flutter Doctor
```shell
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-arm64, locale en-US)
• Flutter version 3.10.6 on channel stable at /Users/marco/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f468f3366c (5 weeks ago), 2023-07-12 15:19:05 -0700
• Engine revision cdbeda788a
• Dart version 3.0.6
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /Users/marco/Library/Android/sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.81.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.70.0
[✓] Connected device (3 available)
• iPhone 14 Pro Max (mobile) • A74D8B76-F676-4449-8598-4230B4D1A65B • ios •
com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.5 22G74
darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome
111.0.5563.64
[✓] Network resources
• All expected network resources are available.
• No issues found!
### 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
Experiencing the same issue on connectivity_plus all the way back to v2.x.x
Reproducible on Simulator reliably.
Flutter Doctor
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-arm64, locale en-IN) • Flutter version 3.10.6 on channel stable at /Users/ashutosh.s/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f468f3366c (5 weeks ago), 2023-07-12 15:19:05 -0700 • Engine revision cdbeda788a • Dart version 3.0.6 • DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.81.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.70.0
We're experiencing the same issue.
I am looking forward to getting this resolved... hopefully.
from my perspective this package works differently in Simulator and Rela Devices. Correct me guys if am wrong!
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days
Any updates? I believe this issue needs to be fixed.
Thanks.
I am having the same issue. 5.0.2
on iOS 17.2
simulator
This is an issue with iOS simulators. As long as it works on a real device, there is nothing to fix.
It is the same case as with network_info_plus
plugin where wifiInfo
will always return null on simulator even when the project has all the required entitlements, configs.
I will update the documentation with this note, though.
In fact, it turns out that it is already mentioned in the first sentence under iOS
section: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus/connectivity_plus#ios