Describe the bug
Amplify (through AmplifyPlugins/AWSAPIPlugin) depends on @ashleymills ReachabilitySwift. This library introduces a conflict with the Objective-C Reachability library used by many other packages as it's author has openly chosen to use a conflicting name and publicly refused to fix the issue (https://github.com/ashleymills/Reachability.swift/issues/348).
As such, by depending on libraries that introduce a naming conflict AWS Amplify is breaking builds through requiring an essentially broken dependency the author openly refuses to fix. The most obvious symptom is a symbol resolution conflict that results in a compiler warning about multiple targets, that at run time, causes as "Symbol not found: _OBJC_CLASS_$_Reachability" error at app start for any app that includes Amplify and any other library that itself directly or indirectly relies on the original Reachability.
Consider dropping this dep and finding an alternative way to replicate Reachability's functions in Swift and this problem goes away.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Compiles without specific warning to this, and runs, no problem.
Environment(please complete the following information):
Device Information (please complete the following information):
Hi @24601
Thanks for reporting this. We'll add this to our backlog and consider options, and update this issue as we have any information.
A preliminary decision (pending an engineering spike) has been made to write a thin layer to replace ReachabilitySwift. We will update the ticket when we know more about when this work can be started.
@24601 ,
I'm trying to reproduce this issue, so that we can be sure we fix this issue correctly.
Can you please suggest a library which "requires Reachability (the objective C version)", so that i can reproduce this issue on my machine?
Thanks
Hello Mr. Woo,
Thanks for looking into this and moving this issue out of the library! I
know that PusherSwift is one that many people have mentioned on
StackOverflow, and it might even have been responsible for ours as a
transient dependency, but let me go back in our SCM history and get the
branch of our app that had this issue and I'll build you a sample repo
demonstrating the issue if you'd like!
Thanks!
Basit
On Tue, Dec 8, 2020 at 12:31 PM John Woo notifications@github.com wrote:
@24601 https://github.com/24601 ,
I'm trying to reproduce this issue, so that we can be sure we fix this
issue correctly.Can you please suggest a library which "requires Reachability (the
objective C version)", so that i can reproduce this issue on my machine?Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/aws-amplify/amplify-ios/issues/797#issuecomment-740904525,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAI2QV2MWWKC3DOZ2OF23BDSTZ5JHANCNFSM4SBHYG5A
.
@wooj2 - we were using graphql_flutter which depended on connectivity which used ReachabilitySwift, but connectivity has moved away from including ReachabilitySwift for this same reason, so the actual test case from our code won't help much with the new version, but pinning to a backlevel version should still replicate it.
BUT, I would still be happy to build you one (that is likely more straightforward as it won't involve the Flutter -> iOS portion) that is just native iOS Swift with PusherSwift as an example
Hi @24601 ,
I've made a draft PR effectively forking Reachability.swift to AmplifyReachability, but before moving forward with this, I'd feel more comfortable if I was able to reproduce the linker error you are seeing.
When you refer to the "Objective-C Reachability" library, which library are you referring to?
Hi @24601 ,
I believe I've been able to reproduce this issue by creating a sample flutter application with connectivity: ^2.0.2 as suggested by @Rayv1 located here, so there's no need for you to build me one.
Just to tie up loose ends, I believe I found the reachability library you were referring to, which seems to be: https://cocoapods.org/pods/Reachability, which looks very similar to the Apple Reachability sample code located here: https://developer.apple.com/library/archive/samplecode/Reachability/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007324
Code changes have been pushed to the main branch. I've applied the pending release tag as this code change is scheduled to be in our next release.
The fix is released in 1.5.2, please take a look https://github.com/aws-amplify/amplify-ios/releases/tag/1.5.2
Most helpful comment
A preliminary decision (pending an engineering spike) has been made to write a thin layer to replace ReachabilitySwift. We will update the ticket when we know more about when this work can be started.