1

我在我的 iOS 项目中使用的一种方法中出现内存泄漏。因为我是 iOS 开发的新手,所以我无法找出正在发生的事情。

http://screencast.com/t/y2lOtssY2NjO

4

3 回答 3

4

您在 alertView 上调用了两次 init。我认为这就是问题所在。

更改如下:

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:str message:kAlertMessage delegate:self cancelButtonTitle:nil otherButtonTitles:@"Install now", @"Cancel", nil];

请参考这个问题:如果我多次调用 init 会发生什么

于 2012-11-29T09:01:03.417 回答
1

static analyser指出UIAlertView在 .Initialize alertView 上的泄漏仅一次。

UIAlertView *alert = [[UIAlertView alloc]initWithTitle:str.....等等

于 2012-11-29T09:03:08.023 回答
0

您可以通过仪器找到这里的教程,点击这里将告诉您或 Xcode->product->analyze

于 2012-11-29T08:57:36.533 回答