Skip to content

fix: prevent coretelephony initialization on simulators - #531

Open
winshaurya wants to merge 1 commit into
amplitude:mainfrom
winshaurya:fix/simulator-coretelephony
Open

fix: prevent coretelephony initialization on simulators#531
winshaurya wants to merge 1 commit into
amplitude:mainfrom
winshaurya:fix/simulator-coretelephony

Conversation

@winshaurya

Copy link
Copy Markdown

Summary

@sojingle

Description

This PR fixes Issue #514 where instantiating CTTelephonyNetworkInfo on iOS 14+ Simulators causes repetitive XPC lookup errors in the Xcode console (failed at lookup with error 3 - No such process).

Since iOS simulators do not have cellular modems or carrier daemons, the CTTelephonyNetworkInfo initialization is entirely unnecessary on this target.

Changes Made:

  • Added a #if TARGET_OS_SIMULATOR guard inside [AMPDeviceInfo carrier] to short-circuit carrier fetching on simulators.
  • Added a testCarrier unit test in DeviceInfoTests.m to verify the fallback behavior on simulator environments.
  • Returns "Unknown" immediately, keeping the console log clean without altering production device behavior.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

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.

Issue with CoreTelephony Initialization on Simulators

1 participant