为什么我不能向 NSMutableArray 添加对象

发布于 2024-12-24 01:49:29 字数 538 浏览 1 评论 0原文

由于某种原因,自从昨晚 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笙痞 2024-12-31 01:49:29

出于某种原因,从昨晚起 Xcode 就停止了正常工作,
它不会自动更正,提供代码提示,并且无法识别
错误直到构建。现在我什至无法让我的代码 100% 工作
正确地。

无关;尝试完全删除派生数据目录并重建。

两个数组都为空

您确定您的 viewDidLoad 方法已被调用吗?设置断点(或打印一些内容)。

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.

Unrelated; try removing your derived data directory entirely and rebuilding.

And Both Array's turn out as null

Are you sure your viewDidLoad method has been invoked? Set a breakpoint (or print something out).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文