我有一个具有以下集合的类:
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface MyViewController : UIViewController
{
NSMutableDictionary *details;
}
@property (nonatomic,retain) NSMutableDictionary *details;
我删除了这个问题的所有不必要的细节。在我包括的实现文件中@synthesize details;
我从另一个视图转发到这个视图,在那个类中我得到了一个本地字典:
NSMutableDictionary *getData = [responsestring JSONValue];
我将它设置为这个类中的可变字典,我尝试了两种方式。两者都在下面提到:
objMyVc.details = [[NSMutableDictionary alloc] initWithDictionary:getData];
objMyVc.details = [getData retain];
一旦我在 MyViewController 中,值详细信息始终为空。为什么会这样?在这种情况下不应该保留价值吗?
[编辑]
我可以确认它getData
不为空,因为我有以下检查:
if ([getData valueForKey:@"VALUE"]) {
}
在if
声明中,我试图将值分配给 details 字典并转发给ViewController
. 我也尝试复制如下:
objMyVc.details = getData;