iOS: - [NSTaggedPointerString objectForKey:]:崩溃

时间:2017-07-18 16:56:51

标签: ios objective-c serialization nsdictionary

这是我的以下代码

   id dataDict = [NSPropertyListSerialization
                               propertyListWithData:[dictionaryStr dataUsingEncoding:NSUTF8StringEncoding]
                               options:kNilOptions
                               format:NULL
                               error:NULL];

  if ([dataDict isKindOfClass:[NSDictionary class]]) { 
       for (NSString *key in dataDict) {
          // value string crashes with the following exception -[NSTaggedPointerString objectForKey:]: 
           NSString *value = [dataDict objectForKey:key];
     }
 }

根据崩溃分析,有一个用户在以下行NSString *value = [dataDict objectForKey:key];发生了崩溃。这对我没有任何意义,因为我事先检查dataDict是否属于NSDictionary类。有人可以向我解释如何防止这次崩溃吗?

0 个答案:

没有答案