Skip to content

fix(ios): use only public APIs on iOS - #195

Merged
shellrow merged 1 commit into
shellrow:mainfrom
iishabakaev:ios-public-apis-main
Oct 25, 2026
Merged

shellrow merged 1 commit into
shellrow:mainfrom
iishabakaev:ios-public-apis-main

Conversation

@iishabakaev

Copy link
Copy Markdown
Contributor

On iOS, netdev calls SystemConfiguration functions that the iOS SDK marks API_UNAVAILABLE(ios, tvos, watchos): SCNetworkInterfaceCopyAll, SCNetworkServiceCopyAll, SCPreferencesCreate, SCDynamicStoreCreate, SCDynamicStoreCopyValue (from os/ios/sc.rs and os/ios/dns.rs, behind the default apple-system-configuration-extra feature). App Store review rejects apps that import them, so apps that get netdev through iroh/netwatch cannot ship there.

It also stopped building for iOS with libc >= 0.2.190: libc::in6_ifreq is macOS-only now (the iOS SDK has no netinet6/in6_var.h), so os/darwin/ipv6_addr_flags.rs fails with E0425 on aarch64-apple-ios.

Changes, iOS only (macOS unchanged):

  • apple-system-configuration-extra has no effect on iOS; os/ios/sc.rs is removed, so iOS loses interface friendly names and DHCP hints (no public replacement I know of)
  • DNS servers come from libresolv (res_ninit + res_getservers) instead of SCDynamicStore
  • IPv6 address flags stay at their defaults (SIOCGIFAFLAG_IN6 is not in the iOS SDK)
  • SystemConfiguration.framework and objc2-system-configuration / objc2-core-foundation are macOS-only

Tested:

  • cargo test on macOS
  • cargo clippy for aarch64-apple-ios and aarch64-apple-ios-sim with --all-features and --no-default-features
  • default_interface example in the iOS 27 simulator: default interface, gateway and DNS servers ([fe80::1, 192.168.1.1]) as expected
  • an app static library built with this branch (through iroh/netwatch) imports no _SC* symbols (nm -u)

If you'd rather keep the iOS SystemConfiguration code for apps outside the App Store, I can move it behind a separate, non-default feature instead of removing it.

SCNetworkInterface, SCNetworkService, SCPreferences and SCDynamicStore are
API_UNAVAILABLE(ios) in the iOS SDK; App Store review rejects apps that
import them. On iOS:

- drop the SystemConfiguration interface metadata (friendly name, DHCP
  hints); apple-system-configuration-extra is now macOS-only
- read DNS resolvers through libresolv (res_ninit / res_getservers)
- return default IPv6 address flags: the iOS SDK has no SIOCGIFAFLAG_IN6,
  and libc >= 0.2.190 defines in6_ifreq for macOS only (E0425 on iOS)
- link SystemConfiguration.framework on macOS only
@shellrow

Copy link
Copy Markdown
Owner

Thanks! Switching to public APIs on iOS makes sense, and the metadata limitations are an acceptable trade-off for App Store compatibility.
I reviewed the changes and found no blocking issues. Looks good to merge.

@shellrow
shellrow merged commit d48084d into shellrow:main Oct 25, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants