Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. func askForTWMail(){
  2. if (Twitter.sharedInstance().session() != nil) {
  3. let shareMailVC=TWTRShareEmailViewController(completion: {(mail:String!, error:NSError!) in
  4. if (mail != nil) {
  5. print("GOT MAIL: (mail)")
  6. self.gotMail()
  7. }else{
  8. print("MAIL VC ERROR: (error)")
  9. }
  10. })
  11. println("PRESENT MAIL VC")
  12. self.presentViewController(shareMailVC, animated: true, completion: nil)
  13. }else{
  14. println("User not logged in")
  15. }
  16. }
  17.  
  18. func gotMail(){
  19. var alertController=UIAlertController(title: "Some title", message: "Some message", preferredStyle: UIAlertControllerStyle.Alert)
  20. var okAction=UIAlertAction(title:"Yes", style: UIAlertActionStyle.Default) {
  21. UIAlertAction in
  22. //some action
  23. }
  24. var cancelAction=UIAlertAction(title:"No", style: UIAlertActionStyle.Cancel){
  25. UIAlertAction in
  26. //some action
  27. }
  28. alertController.addAction(okAction)
  29. alertController.addAction(cancelAction)
  30. self.presentViewController(alertController, animated: true, completion: nil)
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement