主題說明了這一切。我有一本存儲在NSUserDefaults
中的詞典(是的,它是一個字典)。出於某種原因,在將對象設置爲字典之後,我在main.m中獲得了SIGABRT。下面的代碼:將對象設置爲NSMutableDictionary後的SIGABRT
planDict = [[NSUserDefaults standardUserDefaults]objectForKey:[NSString stringWithFormat:@"Plan_%@", self.planName]];
pageOne = [planDict objectForKey:@"Page_1"];
pageTwo = [planDict objectForKey:@"Page_2"];
pageThree = [planDict objectForKey:@"Page_3"];
[pageOne setObject:@"The Object" forKey:@"First Key"];
[pageOne setObject:@"The Other Object" forKey:@"Second Key"];
//other setters
我已經調試它,它很順利,直到行[pageOne setObject:@"TheObject" forKey:@"First Key"];
。當我跨過它時,它剛剛墜毀(SIGABRT在main.m中)。
這裏是在飛機墜毀前的日誌權:
(gdb) po planDict
{
"Page_1" = {
};
"Page_2" = {
};
"Page_3" = {
};
}
(gdb) po pageOne
{
}
(gdb) po pageTwo
{
}
(gdb) po pageThree
{
}
任何幫助,將不勝感激,謝謝。
謝謝,想通了 – Novarg 2012-04-03 07:48:00