Advertisement
iamalizade

Untitled

Sep 16th, 2015
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.74 KB | None | 0 0
  1. var xmppStream: XMPPStream?
  2.     @IBAction func login () {
  3.         setField(username, forKey: kXMPP.myJID)
  4.         setField(password, forKey: kXMPP.myPassword)
  5.        
  6.         if let status = xmppStream!.authenticateWithPassword(password.text){
  7.             print("authentication successful")
  8.         } else{
  9.             print("authentication failed")
  10.         }
  11.        
  12.         do
  13.         {
  14.             //since you may call this more than once; re-name xstream
  15.             //to something else such as, for example, status
  16.             _ = try xmppStream!.authenticateWithPassword(password.text)
  17.             print("authentication successful")
  18.         }
  19.         catch let error as NSError
  20.         {
  21.             print(error)
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement