Skip to content
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

fix(mac-catalyst): add check for mac catalyst target to support the platform #629

Merged
merged 1 commit into from Oct 2, 2022

Conversation

zhumingcheng697
Copy link
Contributor

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 in ios/RNCNetInfo.m and ios/RNCConnectionState.m, I also added another condition for TARGET_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 with ifaddrs.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.

Copy link
Contributor

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly the sort of #if-ing that I have done in other repos to get maccatalyst to work, looks great, thanks for posting it!

@mikehardy mikehardy added the pending merge A PR that will be merged shortly, waiting for CI or final comment label Oct 2, 2022
@mikehardy mikehardy merged commit 8e4cace into react-native-netinfo:master Oct 2, 2022
@mikehardy mikehardy removed the pending merge A PR that will be merged shortly, waiting for CI or final comment label Oct 2, 2022
github-actions bot pushed a commit that referenced this pull request Oct 2, 2022
## [9.3.3](v9.3.2...v9.3.3) (2022-10-02)

### Bug Fixes

* **macCatalyst:** add compilation conditionals for macCatalyst ([#629](#629)) ([8e4cace](8e4cace))
@matt-oakes
Copy link
Collaborator

🎉 This PR is included in version 9.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants