当我的Watch应用加载时,我不认为我的getDataFromPhone
和loadTableData
方法被调用(下面),但forceTouch方法让它们加载正常。所以我认为我的会话未及时激活,以致电getDataFromPhone
和loadTableData
。如何在activateSession
上实现完成块,以便在此之前调用这些方法?
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
if (WCSession.isSupported()) {
session = WCSession.defaultSession()
session.delegate = self
session.activateSession()
}
getDataFromPhone()
loadTableData()
}
@IBAction func refresh() {
print("menu tapped", terminator: "")
getDataFromPhone()
loadTableData()
}