【发布时间】:2010-08-19 08:26:30
【问题描述】:
你好,我有这个数组,它比较两个数组以查看它是否包含一个对象,但是在使用 nslog 对其进行测试后
NSLog (@"1");
favoritesArray = [[NSMutableArray alloc] init];
NSLog (@"2");
//Add items
// favoritesArray = [[NSMutableArray alloc]init];
didContain = [[NSMutableArray alloc]init];
NSLog (@"3");
if ([favoritesArray containsObject:@"one"])
{
[didContain addObject:@"one"];
NSLog (@"4");
}
第四条日志没有出现。 这是否意味着我的实现是错误的,如果它包含一个对象,或者这意味着不存在这样的文件?
编辑 这是我添加数组的地方
-(IBAction) addToFavorites {
favoritesArray = [[NSMutableArray alloc] init];
[favoritesArray addObject:@"one"];
NSLog (@"hello");
这怎么不显示为对象@"one"
【问题讨论】:
-
这段代码中没有任何与文件有关的内容。