Will Taylor
Will Taylor

Reputation: 551

The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated

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?

Upvotes: 28

Views: 33687

Answers (3)

Ramis
Ramis

Reputation: 16549

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

Upvotes: 2

Tim Walsh
Tim Walsh

Reputation: 1105

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

Upvotes: 8

Lifely
Lifely

Reputation: 1065

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`

Upvotes: 17

Related Questions