-1
我有下面的代碼:的NSMutableArray計數等於0時添加對象
-(void)accountAdded:(GoogleMailAccount *)account
{
DLog(@"accountAdded %@ ",account.emailAddress);
DLog(@"_accounts addObject %@ ",account);
[_accounts addObject:account];
DLog(@"_accounts count %d",[_accounts count]);
[_subFolders setValue:[account subscribedFolders] forKey:account.emailAddress];
[self refreshTableViewTree];
}
下一個日誌輸出它:
2013-08-02 00:57:28.009 MailClient[9327:11603] accountAdded [email protected]
2013-08-02 00:57:28.010 MailClient[9327:11603] _accounts addObject <GoogleMailAccount: 0x7db94f0>
2013-08-02 00:57:28.011 MailClient[9327:11603] _accounts count 0
爲什麼佔規模= 0? (這是我的一個真正的問題:(。什麼我不明白???)
是_accounts !?=零 – Tom
是數組_accounts零在ObjC您可以發送郵件到零,所以它不會給一個錯誤,如果它是零,你就可以稱爲方法 – guitarflow
我明白了我的壞? - 我又忘了關於在語言中缺少NullPointerException。謝謝。 – pvllnspk