仪器 xcode4 不工作?

发布于 2024-12-06 08:41:05 字数 1345 浏览 0 评论 0原文

我正在关注 Ray Wenderlich 教程仪器,但我不知道为什么分析没有显示泄漏的对象?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSString * sushiName = [_sushiTypes objectAtIndex:indexPath.row];
NSString * sushiString = [NSString stringWithFormat:@"%d: %@", indexPath.row, sushiName];

NSString * message = [NSString stringWithFormat:@"Last sushi: %@.  Cur sushi: %@", _lastSushiSelected, sushiString];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sushi Power!" 
                                                    message:message 
                                                   delegate:nil 
                                          cancelButtonTitle:nil 
                                          otherButtonTitles:@"OK", nil];
[alertView show];

//_lastSushiSelected = sushiString; //el que jode, pues lo pone en string deallocada, por strinWithFormat que usa autorelease!
_lastSushiSelected = [sushiString retain];

//[alertView release];
}

我使用教程中的代码,正如您所看到的,alertView 正在泄漏!

但我通过仪器泄漏运行它,但什么也没有出现! [确认按下停止按钮以停止分析的速度也非常非常慢!]

未检测到泄漏

那么什么是失踪了??

非常感谢!

Im following Ray Wenderlich tutorial for instruments, but I don't know why the profiling is not showing the leaked object??

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSString * sushiName = [_sushiTypes objectAtIndex:indexPath.row];
NSString * sushiString = [NSString stringWithFormat:@"%d: %@", indexPath.row, sushiName];

NSString * message = [NSString stringWithFormat:@"Last sushi: %@.  Cur sushi: %@", _lastSushiSelected, sushiString];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sushi Power!" 
                                                    message:message 
                                                   delegate:nil 
                                          cancelButtonTitle:nil 
                                          otherButtonTitles:@"OK", nil];
[alertView show];

//_lastSushiSelected = sushiString; //el que jode, pues lo pone en string deallocada, por strinWithFormat que usa autorelease!
_lastSushiSelected = [sushiString retain];

//[alertView release];
}

Im using the code in the tutorial, and as you can see the alertView is leaking!

But I run it trough instruments leaks, and nothing appears! [also is very very very slow to acknowledge the stop button was pressed to stop the profiling!]

Leaks not detected

So what is missing??,

thanks a lot!

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

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

发布评论

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

评论(1

策马西风 2024-12-13 08:41:05

坦白说,我认为这是一个错误。希望它很快就会被修复(我使用的是 v4.1),但一切并没有丢失。在分配工具下,您可以过滤显示的类型。在这张图片中,我告诉它显示 UIAlertView 实例。单击 UITableView 几次后,您可以看到它告诉我有 2 个实例存在,这证实存在泄漏。

在此处输入图像描述

Frankly, I think it's a bug. Hopefully it'll be fixed soon (I'm using v4.1) but all is not lost. Under the Allocations instrument you can filter which types are displayed. In this image I've told it to show UIAlertView instances. After clicking in the UITableView a couple of times you can see it tells me that there are 2 instances living, which confirms that there is a leak.

enter image description here

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