ios - 请求非结构或联合 :error 中的成员 "nameField"

标签 ios objective-c ios5

我的错误消息:

Request for member "nameField" in something not a struct or union

我的错误代码:

NSString *msg = nil;
if (nameField.text.length > 0)
    msg = [[NSString alloc] initWithFormat:@"Relax, %@, all is good".nameField.text];
else
    msg = @"Relax, all is good";

最佳答案

你的代码行

msg = [[NSString alloc] initWithFormat:
       @"You can breathe easy,%@, EveryThing went ok". nameField.text];

试试这个

msg = [[NSString alloc] initWithFormat:
       @"You can breathe easy,%@, EveryThing went ok", nameField.text];
                                                     ^

更改的行是你已经使用过的。此处不用逗号 -> :@"...",

检查这是否有帮助

关于ios - 请求非结构或联合 :error 中的成员 "nameField",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9971296/

相关文章:

ios - 相机 View 未显示

ios - Swift - 如何自动大写 UIButton 的标签?

ios - 从 tableView :cellForRowAtIndexPath: 内的 block 调用时,cellForRowAtIndexPath 始终为零

objective-c - 使用 ACAccountStore 时为 "(null) wants to access twitter"

ios - Swift 中数组的直方图

ios - 了解如何阅读 iOS 文档和 API 引用

ios - Google Admob 集成错误

iphone - 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:在实体NSSQLEntity CategoryDe​​tail id = 2中找不到“键路径父级”

ios - 在字符串中查找纬度和经度

iphone - 如何从 NSData 获取详细信息