【发布时间】:2015-11-05 16:25:12
【问题描述】:
我将 Xcode 更新为新的 Xcode 7 beta 5。在此过程中,它转换为 Swift 2,但随后产生了更多错误。现在,我完全陷入困境,不知道该怎么办,因为虽然我所有的错误都消失了,但我的应用程序将无法正常工作。
我的问题是这样的:
if(self.myOutput3 as? NSObject == true) {
print("IT IS TRUE")
PFUser.logInWithUsernameInBackground(self.myOutput1 as! String, password: "xxx") { (user: PFUser?, error: NSError?) -> Void in
if error == nil {
print("It Worked!")
// self.presentViewController(destViewController, animated: true, completion: nil)
let instillation = PFInstallation.currentInstallation()
instillation["user"] = PFUser.currentUser()
instillation.saveInBackgroundWithBlock(nil)
self.performSegueWithIdentifier("toTimeline", sender: self)
} else {
// self.enterButton.enabled = false
self.errorAlert()
print("Couldn't log in...")
}
}
} else {
print("IT IS FALSE")
self.performSegueWithIdentifier("continueTheSignIn", sender: self)
// self.move()
}
程序将执行 toTimeline 转场,但不会执行 continueTheSignIn 。我看不出这不起作用的任何合乎逻辑的原因。谁能指出我正确的方向?
另外,我的消息功能出现错误。
cell.textView!.linkTextAttributes = [NSForegroundColorAttributeName:cell.textView!.textColor]
这给了我错误“无法将 '[String : UIColor?]' 类型的值分配给 '[String: AnyObject] 类型的值!'
我之前在 Swift / Xcode 6.4 中没有遇到这个错误,所以我不知道如何修复它。
此外,一旦我绕过这个进入我的应用程序以查看我的其他功能是否正常工作,我的大多数 UITableViews 都不会显示任何信息。一个是,但是其余的加载正确数量的行,但什么也不显示。这可能是什么?此外,也没有正确显示 Parse 图片。这些比其他问题更令人担忧...
【问题讨论】:
-
您需要在
textColor之后添加一个!来表示编译错误(如果您确定textColor有一个值)。 -
@zneak 好的,解决了这个错误。对其他人有什么想法吗? (我刚刚编辑了问题以包含我刚刚发现的另一个主要问题)
-
else 语句真的发生了吗?我的意思是,
self.performSegueWithIdentifier("continueTheSignIn", sender: self)行真的执行了吗? -
@dGambit 它到达该行,然后不执行它。但是,如果我用相同的东西替换该行,除了另一个 segue 标识符 toTimeline,它可以工作......我只是不明白。
-
也许您遗漏了 Process 这个词??
标签: ios swift swift2 xcode7 xcode7-beta5