【发布时间】:2014-09-19 22:38:14
【问题描述】:
这行代码:
var errorView = UIAlertView(title: errorTitle, message: errorString, delegate:self, cancelButtonTitle: "Cancel", otherButtonTitles: "OK", nil)
从 Objective-C 代码重写:
UIAlertView *errorView =
[[UIAlertView alloc] initWithTitle:errorTitle
message:errorString delegate:self cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
这给了我这个错误:
类型“字符串”不符合协议“NilLiteralConvertiblle”
我可以通过不在最后加上 nil 来解决它,但我只是不知道为什么,有人知道答案吗?
【问题讨论】: