gpt4 book ai didi

ios - Apple Watch 表 Controller 未加载

转载 作者:可可西里 更新时间:2023-11-01 01:06:29 25 4
gpt4 key购买 nike

我正在使用 WatchKit 开发一个简单的表格应用

我想我已经设置好了所有的东西,但经过大量的挖掘仍然无法弄清楚为什么我的应用程序没有加载。

当我构建应用程序时,没有我的扩展程序代码正在运行(即使在 awakeWithContext 函数中断点也没有激活。

它只显示一个纺车,不会在应用程序中加载任何内容,包括在我禁用交互表代码时加载的其他元素。

这是我的代码:

class VisitorInteractionTable: WKInterfaceController {

@IBOutlet weak var visitorTable: WKInterfaceTable!

let names = ["Friend1", "Friend2", "Friend3", "Friend4", "Friend5"]


override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)


loadTableData()
}

private func loadTableData(){
visitorTable.setNumberOfRows(names.count, withRowType: "VisitorTableRowController")

for (index, friendName) in enumerate(names) {
let row = visitorTable.rowControllerAtIndex(index) as VisitorTableRow
row.rowLabel.setText(friendName)
}
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
NSLog("%@ will activate", self)
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
NSLog("%@ did deactivate", self)
super.didDeactivate()
}
}

我已经检查了我所有的 Storyboard,一切都按照应有的方式连接,我不确定发生了什么。有什么想法吗?

最佳答案

为了运行 Apple Watch 应用程序,它需要一个父 iPhone 应用程序,它会为您的应用程序安装随附的 WatchKit 扩展。在运行 Watch 应用程序之前,您需要至少构建并运行一次 iPhone 应用程序作为主要目标。从症状上看,这似乎以某种方式完成了安装过程,因为在此之后,您的 Watch 应用程序将成功运行。这是对您所描述的症状的一种可能解释。

请注意,这可能只是 Watch 模拟方式的一个症状。 Apple 没有给出任何关于安装 Watch 应用程序的用户体验的指示,因此我们不能得出结论,在附带的支持扩展的 Watch 应用程序在实际的 Apple Watch。

关于ios - Apple Watch 表 Controller 未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27672740/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com