简体   繁体   中英

set device name to a peer in session Multipeer connectivity swift3

I want to build an app something like queue manage that request a queue and call the queue to counter service number 1 2 3 problem is how can I set the device to counter 1, counter 2 depends on device connected

thanks for answer

func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState) {
    switch state {
    case .connected:
        print("connected", peerId)
        lbl.text = UIDevice.current.name
    case .connecting:
        print("connecting")
    case .notConnected:
        print("not Connected")
    default: break
    }
}

Try above code to show device name which is connected.

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