线程破坏为什么?

时间:2014-12-23 05:29:34

标签: ios swift

我正在尝试在用户默认值中生成一个密钥以充当设备的UDID,但我遇到了麻烦。线程在

处中断
} else if (success == 1 && secretKey == ""){

在以下示例中

if(success == 1 && secretKey != "")
                {
                    println("Login SUCCESS w/ key")
                    userDefaults.setValue(team, forKey: "teamid")
                    userDefaults.setValue(scout, forKey: "scout")
                    userDefaults.setValue(password, forKey: "password")
                    userDefaults.setValue(secretKey, forKey: "secretkey")
                    userDefaults.synchronize()
                    self.performSegueWithIdentifier("secondViewController", sender: self)


                } else if (success == 1 && secretKey == ""){
                    var secretKey = randomStringWithLength(15)
                    userDefaults.setValue(team, forKey: "teamid")
                    userDefaults.setValue(scout, forKey: "scout")
                    userDefaults.setValue(password, forKey: "password")
                    userDefaults.setValue(secretKey, forKey: "secretkey")
                    userDefaults.synchronize()
                    println("Login SUCCESS w/o key")
                    self.performSegueWithIdentifier("secondViewController", sender: self)

编辑: (一些背景) 我正在创建的应用程序使用订阅并限制客户登录和注销以及共享登录,用户将获得保存在服务器上的标识符,并将其提供给设备,因此在登录时,它就像一把钥匙。我喜欢drewag建议的内容,谢谢。但是,回到早先的声明。我想检查用户何时提交登录信息,如果他或她已经保存了标识符,并且如果用户这样做,则会跳过创建新登录信息并只发送他们登录的信息。

0 个答案:

没有答案