multiplatform-connectivity-status icon indicating copy to clipboard operation
multiplatform-connectivity-status copied to clipboard

What "context" should I use with ConnectivityStatus constructor on iOS?

Open iRhythmTuan opened this issue 2 years ago • 4 comments

I am trying to integrate the latest version 1.3.0 and run into the following error:

"Expected class ConnectivityStatus does not have default constructor"

Looks like ConnectivityStatus is now expecting an instance of "Context" class. How I create this context instance for iOS app? I looked at the sample app for iOS and noticed that ConnectivityStatus() also doesn't pass any parameter. Is the sample app updated to work with version 1.3.0? Can you update it if it's not? Thanks.

iRhythmTuan avatar Sep 28 '22 00:09 iRhythmTuan

The sample works fine for me with version 1.3.0.

Please not that you cannot use the ConnectivityStatus class from your common module. As the sample shows, you have to define you own wrapper. That's because (as you already discovered) Android needs a context while iOS does not.

So in your common code you have to define a expect class which is implemented for iOS and Android:

Please check that you are not using ConnectivityStatus from you common module. If the error still remains, please upload a minimal example of your code.

ln-12 avatar Sep 28 '22 06:09 ln-12

Thanks, I am able to compile on Android side now. However, when I've tried to compile it on iOS, I ran into the following error:

Undefined symbols for architecture x86_64: "OBJC_CLASS$_Reachability", referenced from: objc-class-ref in result.o ld: symbol(s) not found for architecture x86_64

I have properly import Reachability framework using pod.

How do I resolve this error?

Thanks

iRhythmTuan avatar Sep 29 '22 01:09 iRhythmTuan

Did you try to run my sample?

ln-12 avatar Sep 29 '22 05:09 ln-12

Thanks, I am able to compile on Android side now. However, when I've tried to compile it on iOS, I ran into the following error:

Undefined symbols for architecture x86_64: "OBJC_CLASS$_Reachability", referenced from: objc-class-ref in result.o ld: symbol(s) not found for architecture x86_64

I have properly import Reachability framework using pod.

How do I resolve this error?

Thanks

Was anyone able to get past this?

morgan4080 avatar Jul 31 '23 08:07 morgan4080