iOS 5 表格视图崩溃
新的 SDK 发生了一些变化,我的代码突然无法工作。
我创建了一个新的空项目,并在其中仅创建了一个 UITableView。 我使用了与以前相同的代码,只是编译器说我不再需要使用 autorelease,所以我删除了它。
哦,我按照建议将保留替换为强。
当我运行该应用程序时,它会显示 TableView 的外观,但是当我触摸屏幕上的任何位置(例如滚动)时,它会因 EXC_BAD_ACCESS 错误而崩溃。
我想念什么??
Something got changed at the new SDK and my code suddenly isn't working.
I created a new empty project and created only a UITableView in it.
I used the same code as i've been used to, except the compiler said that i do not need to use autorelease anymore, so i removed it.
Oh, and I replaced retain with strong as i was recommended.
When I run the app it shows the TableView like it should look, but the minute i touch anywhere on screen, like scrolling for example, it crashes with EXC_BAD_ACCESS error.
What do I miss??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该发布一些有关程序崩溃位置的更多信息!但我不认为提到的编译器警告是原因。您应该尝试通过关闭 ARC(自动引用计数)来使用编译器运行您的项目,看看会发生什么。如果可以回去的话,就先回去吧。
另外,可能由于 ARC 而您所做的更改出现了问题。如果您尚未使用 Xcode 重构工具进行更改,我建议您这样做。
因此在 Xcode 菜单中选择:
Edit >重构>转换为 Objectiv-C ARC...
它将遍历您的代码并应用更改。 Apple 建议您的项目在使用之前应该正常运行,不会出现崩溃和警告。
You should post some more informations on where your program crashed! But I don't think the mentioned compiler warnings are the reason. You should have tried to run your project with the compiler by turning of ARC (automatic reference count) and see what happens. If you can go back, do that first.
Also maybe there went something wrong with the changes you made because of ARC . If you have not done the changes with the Xcode refactoring tool I recommend you doing so.
Therefor select in the Xcode Menu:
Edit > Refactor > Convert to Objectiv-C ARC...
It will go through your code and apply the changes. Apple recommends though that your project should work without crashes and warnings before using it.