[英]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:
我正在运行Xcode Beta 10 Version 6.完整的错误是:
[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.}
[NetworkInfo]描述符查询返回错误:错误Domain = NSCocoaErrorDomain Code = 4099“与名为com.apple.commcenter.coretelephony.xpc的服务的连接无效。”UserInfo = {NSDebugDescription =与名为com.apple.commcenter的服务的连接。 coretelephony.xpc无效。}
It gets thrown in my createTaskFromSnapshot() function, on the first line of the function. 它会在我的createTaskFromSnapshot()函数中抛出,在函数的第一行。
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?
为什么我得到它?
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:
好吧,我已经找到了一种在xcode控制台中隐藏它的方法,只需在终端中运行以下命令之一:
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` 您可以随时通过运行具有不同
level
属性的相同命令来重新启用此功能
In my case this type of warning was generated in the case when CTTelephonyNetworkInfo() was used. 在我的例子中,在使用CTTelephonyNetworkInfo()的情况下生成了这种类型的警告。 As this error only generated on simulator I did like this:
由于此错误仅在模拟器上生成,我这样做:
#if targetEnvironment(simulator)
return []
#else
let networkInfo = CTTelephonyNetworkInfo()
return [networkInfo.subscriberCellularProvider]
#endif
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.