基于 ModalViewController 的应用程序在 30 次演示后崩溃
我有一个 ipad 应用程序,其中有类别(其中有 tableviewcontrollers)和详细视图,其中有一个 webview 显示 tableview 上的行信息。
在类别表视图的 didSelectRowAtIndexPath 函数上,我使用的代码为:
DetayViewController *dvc = [[DetayViewController alloc] init];
Blog *b = (Blog *)[self.blogArray objectAtIndex:indexPath.row];
dvc.cagirilanBlog = b;
[self presentModalViewController:dvc animated:YES];
这工作正常。但在使用该应用程序时,如果您单击表视图中的行并打开详细信息页面并关闭它大约 30 次,应用程序就会崩溃并退出。
应用程序崩溃时收到的警告如下:
**Received memory warning. Level=1**
**Received memory warning. Level=2**
**Program received signal: “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")**
当我关闭模式视图控制器时,我将释放在详细视图上使用的所有对象。但我无法解决的问题是为什么它会崩溃?这是一个错误吗?我不能使用presentModalViewController超过30次吗?
请帮我。
谢谢。
I have an ipad App, which has categories (tableviewcontrollers inside it) and detail views which has a webview shows info of the row on tableview.
On didSelectRowAtIndexPath function of category table views i am using the code as:
DetayViewController *dvc = [[DetayViewController alloc] init];
Blog *b = (Blog *)[self.blogArray objectAtIndex:indexPath.row];
dvc.cagirilanBlog = b;
[self presentModalViewController:dvc animated:YES];
This works fine. But when using the app, if you click row in table view and open a detail page and close it for about 30 times, the application crashes and quit.
The warnings i get when the app crashes is like:
**Received memory warning. Level=1**
**Received memory warning. Level=2**
**Program received signal: “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")**
When i dissmiss the modal view controller, i am releasing all the object i used on detail view. But the issue i can not solve is why is it crashing? is that a bug? Can not i use presentModalViewController more than 30 times?
Please help me.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要释放已使用的资源(每个内存分配都需要释放)。
在你的情况下:(
如果没有,你在 dealloc 方法中释放的所有对象都不会被调用!)
你还可以使用 Xcode 提供的 Leak 性能工具。 (对于检测内存泄漏非常有用)
您应该阅读此文档: http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html
You need to release ressources that you have used (each memory allocations need to be released).
In your case :
(If not, all objets you have released in dealloc method won't be called !)
You can also use the Leak performance tool provided with Xcode. (very useful for detecting memory leaks)
You should read this document : http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html