如何在Watch OS2中访问session.activateSession()的完成?

时间:2015-12-15 13:29:50

标签: swift apple-watch watch-os-2

当我的Watch应用加载时,我不认为我的getDataFromPhoneloadTableData方法被调用(下面),但forceTouch方法让它们加载正常。所以我认为我的会话未及时激活,以致电getDataFromPhoneloadTableData。如何在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()
    }

0 个答案:

没有答案