-
-
Notifications
You must be signed in to change notification settings - Fork 976
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
Conflicts between connectivity_plus and Reachability on iOS #563
Comments
Getting same issue |
I've just checked $ flutter create --platforms ios demo
$ cd demo
$ flutter pub add connectivity_plus import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final connectivity = await Connectivity().checkConnectivity();
runApp(MyApp(connectivity: connectivity));
}
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
required this.connectivity,
}) : super(key: key);
final ConnectivityResult connectivity;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Text('$connectivity'),
),
),
);
}
} |
Same result. |
Indeed In the demo app above: $ flutter clean
$ flutter pub get Open simulator: $ open -a Simulator.app Run it: $ flutter run Post your results. If it won't start due to the same issue, try |
Weird enough, I also got this error today for a project that simply worked like a week ago. Similar issue as reported originally, same error, clean didn't do anything. Error:
the used version of Relevant part of my doctor:
The minimal example from @alexbatalov worked for me so I could not reproduce the issue there. I also tried to override the dependency to 2.0.3, but the same issue stays. Running with Also, running the example inside the connectivity_plus project worked without issues :/ |
I think I got a solution. The problem is when you have both the cocoa pods Reachability and ReachabilitySwift in the same project. In my case I was using PusherSwift v8.0.0 which depends on ReachabilitySwift 5.0, this causes a problem with connectivitu_plus which uses Reachability 3.2. Thankfuly PusherSwift no longer uses ReachabilitySwift so this issue is now gone for me. Edit: The Reachability 3.2 pod was last released in 2014! https://cocoapods.org/pods/Reachability and I am not sure if we should be using it, instead, we should switch to ReachabilitySwift 5.0 or we should try to use the framework provided methods instead of depending on a 3rd party. |
hey all, I was able to migrate the iOS plugin from Reachability to ReachabilitySwift, which got rid of the incompatibilities with other plugins. We also have now a shinny swift implementation (shamelessly stolen from the MacOS implementation). I tested this on my project and the solution works. You can try the version 2.1.0 or just grab it with flutter pub upgrade. |
But what to do with this problem if your other plugins or native code uses Objective-C implementation of Reachability? Objective-C and Swift implementations can't work together at the same time and project is broken until removing one of them. Migrating to Swift variant of Reachability you are braking compatibility with other stuff. |
You will have to migrate them or use an old version of this plugin. |
That really does not sound like a good idea since half of the project relying on this library will need to freeze on a legacy version. Maybe remove Reachability.swift at all, similar to what this project did: snowplow/snowplow-ios-tracker#437 (comment) |
I solved it check the link. |
System info
Issue occurs on: iOS
Plugin name: connectivity_plus
Plugin version: ^2.0.2
Steps to Reproduce
App launched and stuck at splash screen.
Logs
The text was updated successfully, but these errors were encountered: