如何将 nil 添加到 nsmutablearray? [英] how to add nil to nsmutablearray?
本文介绍了如何将 nil 添加到 nsmutablearray?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
NSArray *array = [[NSArray alloc] initWithObjects:@"ΕΛΤΑ",
@"ΕΛΤΑ COURIER", @"ACS", @"ACS ΕΞΩΤΕΡΙΚΟ",
@"DHL", @"INTERATTICA", @"SPEEDEX",
@"UPS", @"ΓΕΝΙΚΗ ΤΑΧΥΔΡΟΜΙΚΗ", @"ΜΕΤΑΦΟΡΙΚΕΣ ΕΞΩΤΕΡΙΚΟΥ", nil];
这是有效的,因为它最后为零.
This is working because it has nil at the end.
但我添加这样的对象:addObject:name
等等...所以最后我必须添加 nil 我这样做 addObhect:nil 但是当我运行应用程序时它仍然在 cellForRowAtIndexPath:
But I add objects like this: addObject:name
etc...
So at the end I have to add nil I do this addObhect:nil but when I run the app it still crashes at cellForRowAtIndexPath:
我怎样才能完成这项工作?
how can I do this work?
好的,我不用加nil
我的应用程序崩溃的原因是什么?
What is the reason that my app crashes then?
推荐答案
在调用 addObject
时不能添加 nil.
You can't add nil when you're calling addObject
.
这篇关于如何将 nil 添加到 nsmutablearray?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文