I have a singleton observing CTServiceRadioAccessTechnologyDidChange notification from there we unwrap telephonyInfo.serviceCurrentRadioAccessTechnology dictionary with notification.object and then compare to Radio Access Tech friendly names.
We do the above to detect when device changes from 3G to 4G (that is the end goal) but the notification does not consistent update.
When testing on device we switch in Settings -> Cellular -> Cellular Data Options -> Voice & Data between LTE and 3G and at times the notification does not accurate reflect when device switches to 3G or back to LTE, it gets stuck in 3G or LTE.
Below is the code implementation:
func initializeRadioAccessMonitor() {
let carrierType = telephonyInfo.serviceCurrentRadioAccessTechnology
if let radioTech = carrierType?.first?.value {
self.classifyRadioAccessTech(identifier: radioTech)
}
NotificationCenter.default.addObserver(self, selector: #selector(radioAccessChanged), name: .CTServiceRadioAccessTechnologyDidChange, object: nil)
}
@objc func radioAccessChanged(_ notification: Notification) {
let identifier = notification.object as! String
if let radioAccess = telephonyInfo.serviceCurrentRadioAccessTechnology?[identifier] {
self.classifyRadioAccessTech(identifier: radioAccess)
} else {
print("[DEBUG] Error unable to unwrap radio access")
}
}
func classifyRadioAccessTech(identifier: String) {
print("[DEBUG] Radio Access technology: \(identifier)")
if #available(iOS 14.1, *) {
switch identifier {
case CTRadioAccessTechnologyGPRS, CTRadioAccessTechnologyEdge:
radioAccessSpeed = .lowSpeed
case CTRadioAccessTechnologyLTE:
radioAccessSpeed = .highSpeed
case CTRadioAccessTechnologyNRNSA, CTRadioAccessTechnologyNR:
radioAccessSpeed = .superSpeed
default:
radioAccessSpeed = .mediumSpeed
}
} else {
switch identifier {
case CTRadioAccessTechnologyGPRS, CTRadioAccessTechnologyEdge:
radioAccessSpeed = .lowSpeed
case CTRadioAccessTechnologyLTE:
radioAccessSpeed = .highSpeed
default:
radioAccessSpeed = .mediumSpeed
}
}
}
Am I observing the wrong notification or is there a better way to detect changes between 3G and 4G.
System details:
Xcode 13.0
Device details:
iPad 6th Gen LTE - PadOS 15
iPad 8th Gen LTE - PadOS 14.7.1
Hi all,
Does anyone know if it's possible to get detailed information about the cellular network?
For example:
Connection speed: E, 3G, 4G, 5G
Number of radio towers near me
Information about the connected radio tower
I found this code *3001#12345#* on a website, is it possible to get the information at least from this hidden menu?
Post not yet marked as solved
iPhone 12 has dual-sim cards, in iOS System, set Secondary sim card as main,
then in App, objective-c, use [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:12345"] options:@{} completionHandler:^(BOOL success) to make a call,
iOS System will still use the First sim card to call.
If making a call directly in iOS system dial panel, it will use the Secondary sim card to call.
Why? How to solve this?
Post not yet marked as solved
From iOS Client-side we need to obtain the ECGI (E-UTRAN Cell Global Identifier) information of the connected network tower.
Is there any iOS API that can provide information?
Post not yet marked as solved
How to Get CellID, MCC, MNC, LAC, and Network in iOS 13 from Objective c?
Post not yet marked as solved
I work for one of the networks. I am able to successful download the eSIM in iPhone for iOS 13.*.
Where I was taken to unknown state (CTCellularPlanProvisioningAddPlanResult) in iOS 14.0 always also it prompt the os screen to install eSIM("Set up Mobile Plan")
Please let me know why it take to unknown state always and why OS screen popup ?, please let me know if any configuration needed specific for iOS 14.x
Also attached the configuration & prototype code for your reference
hud.show(animated: true)
let plan = CTCellularPlanProvisioning()
self.request = CTCellularPlanProvisioningRequest()
self.request?.address = "" // SMDP Address
self.request?.matchingID = "" // Acitvation code.
if let validRequest = self.request {
weak var weakSelf = self
plan.addPlan(with: validRequest) {[weak self] result in
self?.hud.hide(animated: true)
switch result {
case .success:
weakSelf?.alertMessageToUser(title: "Hurray !...", message: "ESIM Downloaded Successfully")
print("Successful")
case .fail:
print("ESIM Download failed, contact your carrier")
case .unknown:
print("Unknown details, contact your carrier")
@unknown default:
print("Unknown details, CONTACT CARRIER")
}
}
}
}
<array>
<dict>
<key>MCC</key>
<string></string> // Country Code
<key>MNC</key>
<string></string> //Network Code
</dict>
</array>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.CommCenter.fine-grained</key>
<array>
<string>spi</string>
<string>sim-authentication</string>
<string>identity</string>
</array>
<key>com.apple.wlan.authentication</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>apple</string>
<string>com.apple.identities</string>
<string>com.apple.certificates</string>
</array>
<key>com.apple.private.system-keychain</key>
I am successful in download eSIM to iPhone for 13.*, Where I was getting the below error for iOS 14.0.1
Logs(OSACTIVITYMODE enabled)
Remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
BackTrace
thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1frame #0: 0x0000000104cf9428 My Optus`closure #1 in ViewControllerTwo.installESIM_1(result=unknown, self=0x0000000107904d80, weakSelf=0x0000000107904d80) at ViewControllerTwo.swift:44:25 frame #1: 0x0000000104cf99a4 My Optus`thunk for @escaping @callee_guaranteed (@unowned CTCellularPlanProvisioningAddPlanResult) -> () at <compiler-generated>:0
frame #2: 0x0000000194fe412c CoreTelephony`__60-[CTCellularPlanProvisioning addPlanWith:completionHandler:]_block_invoke + 28
frame #3: 0x0000000195053268 CoreTelephony`__90-[CoreTelephonyClient(CellularPlanManager) addPlanWith:appName:appType:completionHandler:]_block_invoke + 36
frame #4: 0x0000000105077b68 libdispatch.dylib`_dispatch_call_block_and_release + 32
frame #5: 0x00000001050795f0 libdispatch.dylib`_dispatch_client_callout + 20
frame #6: 0x0000000105088890 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1000
frame #7: 0x0000000194a271e4 CoreFoundation`CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16
frame #8: 0x0000000194a213b4 CoreFoundation`__CFRunLoopRun + 2508
frame #9: 0x0000000194a204bc CoreFoundation`CFRunLoopRunSpecific + 600
frame #10: 0x00000001ab4a5820 GraphicsServices`GSEventRunModal + 164
frame #11: 0x00000001973c4734 UIKitCore`-[UIApplication _run] + 1072
frame #12: 0x00000001973c9e10 UIKitCore`UIApplicationMain + 168
frame #13: 0x0000000104cfb688 My Optus`main at AppDelegate.swift:12:7
frame #14: 0x00000001946e7e60 libdyld.dylib`start + 4
Post not yet marked as solved
i would like to know why i have crashes with core telephony, i'm using it only to detect what is the connection is it 3g or 4g, also to know if i'm connected to the internet or no
here is the crash trace
0 libobjc.A.dylib 0x1bb8c21c8 objc_msgSend + 8
1 CoreFoundation 0x1a6cbb41c -[__NSDictionaryM objectForKeyedSubscript:] + 184
2 CoreTelephony 0x1a734454c -[CTTelephonyNetworkInfo updateRat:descriptor:] + 144
3 CoreTelephony 0x1a7344430 -[CTTelephonyNetworkInfo queryRatForDescriptor:] + 164
4 CoreTelephony 0x1a73431b8 -[CTTelephonyNetworkInfo connectionStateChanged:connection:dataConnectionStatusInfo:] + 72
5 CoreFoundation 0x1a6de3724 __invoking___ + 148
6 CoreFoundation 0x1a6cb6d04 -[NSInvocation invoke] + 380
7 CoreFoundation 0x1a6cb7308 -[NSInvocation invokeWithTarget:] + 80
8 CoreTelephony 0x1a734d2cc void dispatch::async<-[CoreTelephonyClientMux sink:handleNotification:]::$_2>(dispatch_queue_s*, std::__1::unique_ptr<-[CoreTelephonyClientMux sink:handleNotification:]::$_2, std::__1::default_delete<-[CoreTelephonyClientMux sink:handleNotification:]::$_2> >)::'lambda'(void*)::__invoke(void*) + 44
9 libdispatch.dylib 0x1a69cb81c _dispatch_client_callout + 20
10 libdispatch.dylib 0x1a69d3004 _dispatch_lane_serial_drain + 620
11 libdispatch.dylib 0x1a69d3c00 _dispatch_lane_invoke + 404
12 libdispatch.dylib 0x1a69de4bc _dispatch_workloop_worker_thread + 764
13 libsystem_pthread.dylib 0x1f2a4e7a4 _pthread_wqthread + 276
14 libsystem_pthread.dylib 0x1f2a5574c start_wqthread + 8