我正在處理深層嵌套的NSArray和NSDictionary的,這是非常耗時的說至少。 [data objectatindex:0] valueForKey:@「blah」]等等美化NSArray和NSDictionary的NSLog
有誰知道一個不錯的iOS類別遞歸記錄結構,突出顯示類型和顯示值?
可能會問一點,但你永遠不知道:)
我正在處理深層嵌套的NSArray和NSDictionary的,這是非常耗時的說至少。 [data objectatindex:0] valueForKey:@「blah」]等等美化NSArray和NSDictionary的NSLog
有誰知道一個不錯的iOS類別遞歸記錄結構,突出顯示類型和顯示值?
可能會問一點,但你永遠不知道:)
也許這樣嗎?
for (id key in dictionary) {
NSLog(@"key: %@, value: %@ \n", key, [dictionary objectForKey:key]);
}
,但我想不出讓輸出漂亮的副本除外的&任何很好的方式,將其粘貼到jsonFormatter(例如)
編輯:@Andrey Starodubtsev具有的XCode解決方案>低於5.x的:
NSLog(@"%@", dictionaryYouWantToPrint);
也許你可以的iOS5後用塊,像
[anArray enumerateObjectsUsingBlock:^(id object, NSUInteger index, BOOL *stop) {
NSLog (@"object->%@",object);
}];
[aDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id object, BOOL *stop){
NSLog(@"key->%@, value-> %@",key,object);
}];
嗯。下面的結果對我來說簡單
NSLog(@"%@", dictionaryYouWantToPrint);
輸出:
{
id = 1;
matchCount = 0;
matchPattern = abcdef;
number = "123456";
sessionID = 5;
status = Unknown;
timerStart = 1367229348;
}
的方式的Plist類似的顯示在XCode的?這是要顯示在設備上還是僅供您使用? –