ios - Sinch: How do I set the SINCall variable in Swift? -


i'm having bit of confusion on how create sincall object. understand sincall type protocol, , in swift tried create such:

var _call: sincall?

when try call, app crashes because _call nil.

however, if add sincall list of protocols next sincalldelegate, , sincallclientdelegate, error i'm not conforming sincall protocol.

class callviewcontroller: uiviewcontroller, sincalldelegate, sincallclientdelegate {      var username: string? {         didset {          }     }     var recepientuser: string? {         didset {          }     }      var _call: sincall?      var appkey = "xxx"     var appsecret = "xxx"     var host = "xxx"      var client: sinclient {         return sinch.clientwithapplicationkey(appkey, applicationsecret: appsecret, environmenthost: host, userid: username!)  }  override func viewdidload() {     super.viewdidload()     print("lock , load")      client.callclient().delegate = self     client.setsupportcalling(true)     client.start()     client.startlisteningonactiveconnection()      calluser() }  func calluser() {     self._call = client.callclient().calluserwithid(self.recepientuser!)     self._call!.delegate = self }  func client(client: sincallclient!, didreceiveincomingcall call: sincall!) {     call.delegate = self     self._call = call     self._call!.answer() }  // calldidprogress, calldidestablish, calldidend implemented below ... 

is client started when make call, can take few seconds should start the client in app delegate when launched, , when client started can call, nil because client not started


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -