Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios5 NSMutableDictionary iVar初始化失败_Ios5_Nsmutabledictionary - Fatal编程技术网

Ios5 NSMutableDictionary iVar初始化失败

Ios5 NSMutableDictionary iVar初始化失败,ios5,nsmutabledictionary,Ios5,Nsmutabledictionary,试图从临时本地NSMutableDictionary(tmpDict)填充NSMutableDictionary(listContent),但listContent的初始化似乎失败了,因此,无法从tmpDict转移内容。我做错了什么 谢谢 我的.h文件中的声明 // .h NSMutableDictionary *listContent; ... @property (nonatomic, strong) NSMutableDictionary *listContent; - (void

试图从临时本地NSMutableDictionary(tmpDict)填充NSMutableDictionary(listContent),但listContent的初始化似乎失败了,因此,无法从tmpDict转移内容。我做错了什么

谢谢

我的.h文件中的声明

// .h
 NSMutableDictionary *listContent;
 ...
 @property (nonatomic, strong) NSMutableDictionary *listContent;
- (void)viewDidLoad
{
   NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] init];

   //-- populating tmpDict here ....


  //Bring to life, this dictionary
  self.listContent = [NSMutableDictionary new];

 //--- self.listContent is still not alive   
  if(!self.listContent)
     NSLog(@"listContent is not alive, yet");

//populate self.listContent with contents of tmpDict        
[self.listContent addEntriesFromDictionary:tmpDict];

//--- self.listContent is still not alive 
 if(!self.listContent)
     NSLog(@"listContent is not alive, yet");


}
实施文件

// .h
 NSMutableDictionary *listContent;
 ...
 @property (nonatomic, strong) NSMutableDictionary *listContent;
- (void)viewDidLoad
{
   NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] init];

   //-- populating tmpDict here ....


  //Bring to life, this dictionary
  self.listContent = [NSMutableDictionary new];

 //--- self.listContent is still not alive   
  if(!self.listContent)
     NSLog(@"listContent is not alive, yet");

//populate self.listContent with contents of tmpDict        
[self.listContent addEntriesFromDictionary:tmpDict];

//--- self.listContent is still not alive 
 if(!self.listContent)
     NSLog(@"listContent is not alive, yet");


}

从LLDB切换到GBD修复了此问题。问题是我的字典在初始化并填充对象后被LLBD报告为nil。一旦我切换到GBD,所有的东西都被正确地初始化和水合了。

我认为你最好使用
[NSMutableDictionary]
而不是
[NSMutableDictionary new]
。是的。我试过了。没有变化。。。