简体   繁体   中英

how to share data between watch and iphone in xcode 8

Before xcode 8 - i was using following code, but it is not working now- delegate method from watch side is not getting called

if WCSession.isSupported() {
        let watchSession = WCSession.defaultSession()
        watchSession.delegate = self
        watchSession.activateSession()
        if watchSession.paired && watchSession.watchAppInstalled {
            do {
                try watchSession.updateApplicationContext(["key1": "value1"])
            } catch let error as NSError {
                print(error.description)
            }
        }
    }

in above code if condition is not being satisfied.

确保您同时在两个目标(手表和手机)中都启用了分组功能

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM