【发布时间】:2013-01-26 18:52:35
【问题描述】:
无法理解为什么这不起作用,它只是说 id num 以前每次都没有使用过......并且从未将其添加到数组中。对此的任何帮助将不胜感激。我几乎肯定错过了一些明显的东西,但这让我发疯。
- (IBAction)idNumInputEnd:(id)sender
{
// Check if ID Number has been used before, if it hasnt, add it to the list.
NSString *idNumCheck = idNumberInput.text;
if ([idNumberList containsObject:idNumCheck])
{
NSLog(@"This id number has been used before, ask user if he would like to reload the data");
}
else
{
NSLog(@"This id number hasn't been used before and is thus being added to the array");
[idNumberList addObject:idNumCheck];
}
}
【问题讨论】:
-
你确定你的方法被调用了吗?尝试在其中放置一个断点。知道
idNumCheck和idNumberList的值也会很有趣 -
可能idNumberList从未被分配+初始化。
标签: nsstring nsmutablearray nsarray