NSMutableArray 对象的 ObjectAtIndex 方法

发布于 2024-12-23 08:05:10 字数 172 浏览 1 评论 0原文

我正在使用 NSMUtableArray 来存储我创建的一些对象。但是当我写 [myArray objectAtIndex:i] 时,其中 i 是该特定数组的有效索引,会发生以下两件事之一:如果我使用模拟器来运行应用程序,一切正常...如果我在我的应用程序上运行应用程序Iphone 应用程序崩溃...有任何线索说明为什么崩溃吗?

I'm using an NSMUtableArray to store some objects I created. but when I write [myArray objectAtIndex:i] where i is a valid index for that particvular array one of two thing happens: if I'm using the simulator to run the app everything works ok...If I run the app on my Iphone the app crashes...any clues why is it crashing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

等待我真够勒 2024-12-30 08:05:10

很可能是内存管理问题。您是否遵守 内存管理编程指南?尝试:

  • 修改内存管理规则,确保您没有使用任何不属于您的对象,确保保留您想要保留的对象(并在之后适当地释放它们);
  • 通过静态分析器运行您的代码;
  • 启用 NSZombies;
  • 通过 Leaks 运行您的应用程序。

您没有向我们提供足够的信息,无法为您提供可靠、直接的答案。

Likely it is a memory management issue. Are you abiding by rules set out in the Memory Management Programming Guide? Try:

  • revising the memory management rules, make sure you are not using any objects that you don't own, make sure you are retaining objects you want to keep (and releasing them appropriately afterwards);
  • running your code through the static analyser;
  • enabling NSZombies;
  • running your app through Leaks.

You have not given us anywhere near enough information for us to give you a reliable, straightforward answer.

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