这是我的代码:
for (int i=0; i<countingArray.count; i++) {
NSDictionary *element=[countingArray objectAtIndex:i];
NSString *source=[element objectForKey:@"id"];
NSInteger count= [[element objectForKey:@"count"] integerValue];
NSLog("source: %@",source); //Works
NSLog("count %d",count); //Don't Work! Error at this line
for(int c=0; c<subscriptions.count; c++) {
SubscriptionArray * element =[subscriptions objectAtIndex:c];
NSLog(@"sorgente sub %@",element.source);
NSLog(@"sorgente counting %@",source);
if([source isEqualToString:element.source]) {
element.count=count;
[subscriptions replaceObjectAtIndex:c withObject:element];
NSLog(@"equal");
//this part of code is never been executed but I'm sure that
//the if condition in some cases returns true
}
}
}
当我尝试在NSLog("count %d",count);
没有任何信息的情况下让我的应用程序崩溃时。我还有另一个问题,if([source isEqualToString:element.source])
我确定有时条件返回真......如何删除空格?像 php 中的 trim 函数?谢谢