问题描述
我正在尝试更新模拟器中的手表并发症。但是 session.isComplicationEnabled
始终返回 false,尽管在活动表盘上启用了复杂功能。
func sendDataToWatch() {
if WCSession.isSupported() {
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let jsonData = try encoder.encode(self.data)
if let jsonString = String(data: jsonData,encoding: .utf8) {
print(jsonString)
// send to watch
let session = WCSession.default
if session.isWatchAppInstalled {
do {
let dictionary = ["dataForWatch": jsonString]
// update complications
let isReachable = session.isReachable
if !isReachable {
if session.isComplicationEnabled {
session.transferCurrentComplicationUserInfo(dictionary)
}
}
} catch {
print("ERROR: \(error)")
}
}
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)