xcode 与名为 com.apple.commcenter.coretelephony.xpc 的服务的连接无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52127186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated
提问by Will Taylor
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 版本 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] 描述符查询返回错误:错误域=NSCocoaErrorDomain 代码=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?
这个错误是什么意思?为什么我会得到它?
回答by Lifely
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
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
属性的相同命令重新启用此功能
回答by Tim Walsh
回答by Ramis
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:
在我的情况下,这种类型的警告是在使用 CTTelephonyNetworkInfo() 的情况下生成的。由于此错误仅在模拟器上生成,因此我是这样做的:
#if targetEnvironment(simulator)
return []
#else
let networkInfo = CTTelephonyNetworkInfo()
return [networkInfo.subscriberCellularProvider]
#endif