如何自己连接几个设备ios

时间:2016-09-09 00:37:19

标签: ios swift

我需要你的帮助,我不知道如何连接很多设备和同步,例如在所有设备中同时打开灯但我不想连接到LAN或类似的东西,我有试过WiFi,但它是异步的,我使用gps日期和同步这个例子,如果小时结束对值,我打开灯,但效率不高。

// get location

  var manager: CLLocationManager

func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
    if status == .AuthorizedAlways || status == .AuthorizedWhenInUse {
        self.manager.startUpdatingLocation()
    }
}

func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    let location = locations.last!

    if !timerStarted {
        self.startTimeInterval =     location.timestamp.timeIntervalSinceNow
        self.time = location.timestamp
        timerStarted = true
        self.syncSecond()

        manager.stopUpdatingLocation()
    }
}

我使用连接wifi或蓝牙

MCNearbyServiceAdvertiserDelegate
MCNearbyServiceBrowserDelegate
MCSessionState 
MCSessionDelegate

只是,我正在做测试

0 个答案:

没有答案