fix(mac-catalyst): add check for mac catalyst target to support the platform #629
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
There have been some issues and PRs on Mac Catalyst support like #392, #412, and #415, and #415 specifically supposed to have added the support, but I was still getting compilation errors like what @giona69 posted in #392 (comment).
For each
#if
platform check inios/RNCNetInfo.m
andios/RNCConnectionState.m
, I also added another condition forTARGET_OS_MACCATALYST
similar to what was proposed in #412 and now everything compiles and runs.I have little experience with Objective-C or macOS development, and I have no idea why
CoreTelephony
was not compiling, but the existing implementation withifaddrs.h
seems to work perfectly fine for Mac Catalyst.Test Plan
I modified the
node_modules/@react-native-community/netinfo/ios
source code under my React Native project with my fixes and it now runs perfectly fine.useNetInfo
is returning updated information when I disconnect or reconnect to internet.