我需要一些關於可能導致我的問題的原因。我有一個源代碼,我想對它進行一些調試,但我看不到變量。調試問題 - 值被隱藏
例如:
NSArray *oldSavedArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingSavedArray];
NSLog(@"The content of oldSavedArray is%@",oldSavedArray);
,我得到這樣的:
2015-05-04 11:06:28.275 MobilePocket[59803:12619613] The content of oldSavedArray is(
"<MPCheckedCurrency: 0x7f9903b21090>",
"<MPCheckedCurrency: 0x7f9903b20fc0>",
"<MPCheckedCurrency: 0x7f9903b21130>",
"<MPCheckedCurrency: 0x7f9903b21170>",
"<MPCheckedCurrency: 0x7f9903b21510>",
"<MPCheckedCurrency: 0x7f9903b21190>"
)
或本:
NSUserDefaults *currentDefaults = [NSUserDefaults standardUserDefaults];
NSData *dataRepresentingSavedArray = [currentDefaults objectForKey:currencyCheckedArrayKey];
我得到某事像這樣:
(lldb) po dataRepresentingSavedArray
<62706c69 73743030 d4010203 0405064d 4e582476 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 ...etc
可能是從這個問題:
@implementation MPCheckedCurrency
@synthesize currencyCode;
@synthesize currencyValue;
- (void)encodeWithCoder:(NSCoder *)coder;
{
[coder encodeObject:currencyCode forKey:currencyCheckedCodeKey];
[coder encodeObject:currencyValue forKey:currencyCheckedValueKey];
}
- (id)initWithCoder:(NSCoder *)coder;
{
self = [super init];
if (self != nil)
{
self.currencyCode = [coder decodeObjectForKey:currencyCheckedCodeKey];
self.currencyValue = [coder decodeObjectForKey:currencyCheckedValueKey];
}
return self;
}
我怎樣才能看到陣列的內容? 任何幫助將是apreciate!
在'NSLog'之後放置一個斷點,然後可以查看數組中的內容。 –
你的數組包含MPCheckedCurrency對象 –
好的,我該怎麼做才能看到值? –