24

Im getting the error in the title when I run my app. I am running Xcode Beta 10 Version 6. The full error is:

[NetworkInfo] Descriptors query returned error: Error Domain=NSCocoaErrorDomain Code=4099 “The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.” UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.}

It gets thrown in my createTaskFromSnapshot() function, on the first line of the function.

My code:

func observeDatabase(_ tableToUpdate: UITableView) {
    taskDatabase.observe(.childAdded) { (snapshot) in
        self.handleChildAdded(snapshot: snapshot)
        tableToUpdate.reloadData()
    }
}

private func handleChildAdded(snapshot: 
    let addedTask = createTaskFromSnapshot(snapshot)
    taskList.append(addedTask)
}

private func createTaskFromSnapshot(_ snapshot: DataSnapshot) -> Task {
    let snapshotValue = snapshot.value as! Dictionary<String, String> // error is thrown here

    let taskTitle = snapshotValue["taskTitle"]!
    let newTask = Task(title: taskTitle)
  return newTask
}

What does this error mean? and why am I getting it?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Will Taylor
  • 511
  • 1
  • 6
  • 14
  • The error and the code in your question seem unrelated to me. What makes you think the error is caused by this code? – Frank van Puffelen Sep 01 '18 at 13:57
  • Looks unrelated to me as well. I copy and pasted your code into my app (changing Task to a String for testing) and it worked fine. As a suggestion, I would change *Dictionary* to *[String: Any]* unless you know for certain every node will contain key:value pairs of String:String – Jay Sep 01 '18 at 14:02
  • Thats the line Xcode highlights as the error. Each task is stored as Dictionary – Will Taylor Sep 01 '18 at 15:58
  • Good. Then issue may be that one of your values isn't a string but you are trying to force it to be. I would change it per my comment above and then either add error handling code for when its not a string or print out your values and try to spot one that its't. – Jay Sep 02 '18 at 13:13
  • 1
    Anyone find a solution? Getting same error message; Launch Screen appears, then app crashes. `...Failed to create remote object proxy: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.} ...Failed to ping server after delegate was set ...Failed to create synchronous remote object proxy: [NetworkInfo] Descriptors query returned error` – James D. Schwartz Sep 27 '18 at 03:21
  • My guess is that we have to wait for an update of Firebase. For now, use device instead of sim. – Yasper Oct 07 '18 at 21:14
  • Does this answer your question? [Xcode 10 seems to break com.apple.commcenter.coretelephony.xpc](https://stackoverflow.com/questions/52455652/xcode-10-seems-to-break-com-apple-commcenter-coretelephony-xpc) – Blazej SLEBODA Mar 28 '22 at 15:50

3 Answers3

15

The message is probably unrelated to the crash/issue.

I've had this message bother me for a while now with no way of removing it. Well I've found a way to hide this in your xcode console just run one of the following command in a terminal:

xcrun simctl spawn booted log config --mode "level:off" --subsystem com.apple.CoreTelephony

sudo log config --mode "level:off" --subsystem com.apple.CoreTelephony

you can always re-enable this at anytime by running the same command with a different level attribute`

Community
  • 1
  • 1
Lifely
  • 1,035
  • 12
  • 22
  • @Dhruv are you referencing the error mentioned in first message ? Are you using a device or simulator ? – Lifely Dec 12 '18 at 15:07
  • 1
    This is an EXCELLENT solution to the CoreTelephony log issue, which is what brought me here. Didn't know you could configure the simulator log in that manner. – Doug Boutwell Aug 23 '22 at 17:39
  • @DougBoutwell might I suggest you dig more into the suggest then. OsLog as since evolved greatly. There now unified logging which is great and can be implemented w/ signposts metric, reports, categories, sub-services and more. You can find more on site like avanderlee or swiftbysundell or directly at developer.apple.com – Lifely Aug 25 '22 at 01:07
9

Try this:

1- From Xcode menu open: Product > Scheme > Edit Scheme

2- On your Environment Variables set OS_ACTIVITY_MODE = disable

enter image description here

Tim Walsh
  • 1,089
  • 11
  • 27
1

In my case this type of warning was generated in the case when CTTelephonyNetworkInfo() was used. As this error only generated on simulator I did like this:

#if targetEnvironment(simulator)
    return []
#else
    let networkInfo = CTTelephonyNetworkInfo()
    return [networkInfo.subscriberCellularProvider]
#endif
Ramis
  • 13,985
  • 7
  • 81
  • 100