为什么我不能向 NSMutableArray 添加对象
由于某种原因,自从昨晚 Xcode 就停止正常工作,它不会自动更正、提供代码提示,并且在构建之前不会识别错误。现在我什至无法让我的代码 100% 正常工作。
我的对象不会添加到我的数组中。
.h
NSMutableArray *notesTitle;
NSMutableArray *notesBody;
.m
- (void)viewDidLoad
{
[super viewDidLoad];
notesTitle = [[NSMutableArray alloc]init];
notesBody = [[NSMutableArray alloc]init];
}
...
[notesTitle addObject:noteTitle.text];
[notesBody addObject:noteText.text];
///noteTitle.text and noteText.text do contain Text
两个数组都为空
For some reason since last night Xcode just stopped working properly, it doesn't autocorrect, provide code hints, and doesn't recognize errors until built. And now I can't even get my code to work 100% properly.
My objects won't add to my array.
.h
NSMutableArray *notesTitle;
NSMutableArray *notesBody;
.m
- (void)viewDidLoad
{
[super viewDidLoad];
notesTitle = [[NSMutableArray alloc]init];
notesBody = [[NSMutableArray alloc]init];
}
...
[notesTitle addObject:noteTitle.text];
[notesBody addObject:noteText.text];
///noteTitle.text and noteText.text do contain Text
And Both Array's turn out as null
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无关;尝试完全删除派生数据目录并重建。
您确定您的 viewDidLoad 方法已被调用吗?设置断点(或打印一些内容)。
Unrelated; try removing your derived data directory entirely and rebuilding.
Are you sure your
viewDidLoad
method has been invoked? Set a breakpoint (or print something out).