相关疑难解决方法(0)

Swift尝试显示其视图不在窗口层次结构中的UIAlertController(在TWTRShareEmailViewController之后显示)

我在我的应用程序的注册过程中使用Twitter登录.而且我要求用户的电子邮件.一旦我得到它,我想呈现一个UIAlertController.

这是我的代码:

func askForTWMail(){
    if (Twitter.sharedInstance().session() != nil) {
        let shareMailVC=TWTRShareEmailViewController(completion: {(mail:String!, error:NSError!) in
            if (mail != nil) {
                print("GOT MAIL: \(mail)")
                self.gotMail()
            }else{
                print("MAIL VC ERROR: \(error)")
            }
        })
        println("PRESENT MAIL VC")
        self.presentViewController(shareMailVC, animated: true, completion: nil)
    }else{
        println("User not logged in")
    }
}

func gotMail(){
    var alertController=UIAlertController(title: "Some title", message: "Some message", preferredStyle: UIAlertControllerStyle.Alert)
    var okAction=UIAlertAction(title:"Yes", style: UIAlertActionStyle.Default) {
    UIAlertAction in
    //some action
    }
    var cancelAction=UIAlertAction(title:"No", style: UIAlertActionStyle.Cancel){
    UIAlertAction in
    //some action
    }
    alertController.addAction(okAction)
    alertController.addAction(cancelAction)
    self.presentViewController(alertController, animated: true, …
Run Code Online (Sandbox Code Playgroud)

email twitter ios swift uialertcontroller

14
推荐指数
2
解决办法
2万
查看次数

标签 统计

email ×1

ios ×1

swift ×1

twitter ×1

uialertcontroller ×1