Ios5 iOS内存管理问题与属性有关

Ios5 iOS内存管理问题与属性有关,ios5,Ios5,我有一个具有以下集合的类: #import <UIKit/UIKit.h> #import "AppDelegate.h" @interface MyViewController : UIViewController { NSMutableDictionary *details; } @property (nonatomic,retain) NSMutableDictionary *details; 我将它设置为这个类中的可变字典,我尝试了两种方法。这

我有一个具有以下集合的类:

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface MyViewController : UIViewController
{
    NSMutableDictionary *details;           
}
@property (nonatomic,retain) NSMutableDictionary *details;
我将它设置为这个类中的可变字典,我尝试了两种方法。这两种情况如下所述:

objMyVc.details = [[NSMutableDictionary alloc] initWithDictionary:getData];
objMyVc.details = [getData retain];
一旦进入MyViewController,值详细信息总是空的。为什么会这样?在这种情况下不应该保留该值吗

[编辑]

我可以确认
getData
不为空,因为我有以下检查:

if ([getData valueForKey:@"VALUE"]) {

}
正是在
if
语句中,我试图将值分配给详细信息字典并转发到该
ViewController
。我也试着复制如下:

objMyVc.details = getData;

您的代码似乎是正确的。您检查过getData是否为空吗?我还将在初始化细节后立即检查它是否为空。我不认为您的问题与保留有关。

是的,
getData
肯定不是空的。因为我手头有一个if语句来确认相同的内容。另外,我还有一个
NSLog
语句来输出它的值。是的,它将被保留。更重要的是,由于您的属性标记为retain,并且您调用了additional alloc或retain,因此您将发生泄漏。在另一个地方有些不对劲。你是怎么查空的?
objMyVc.details = getData;