iosswiftmicrosoft-band

await Band to Connect iPhone


I am trying to connect to Microsoft's Band from the iPhone via swift with this method:

override func Connect() -> Connection {
 MSBClientManager.sharedManager().connectClient(self.band)
return .connected
}

When the connection happens, the SDK calls:

public func clientManager(clientManager: MSBClientManager!, clientDidConnect client: MSBClient!)

I tried putting a while(clientManagerNotCalled){}, but it blocks calling clientManager, how can I wait for the method to be called? before returning the connection state?


Solution

  • I couldn't find a solution to this situation, so I found a way around:

    create a function to be called, with the parameter of connection state.

    call the function when client manager calls:

    public func clientManager(clientManager: MSBClientManager!, clientDidConnect client: MSBClient!)