我使用 JSONModel 从 json 中捕获数据:
@interface BBTCampusBus : JSONModel
@property (strong, nonatomic) NSString * Name;
@property (assign, nonatomic) NSUInteger Latitude;
@property (assign, nonatomic) NSUInteger Longitude;
@property (nonatomic) BOOL Direction;
@property (assign, nonatomic) NSUInteger Time;
@property (nonatomic) BOOL Stop;
@property (strong, nonatomic) NSString * Station;
@property (assign, nonatomic) NSInteger StationIndex;
@property (assign, nonatomic) NSUInteger Percent;
@property (nonatomic) BOOL Fly;
@end
我有以下代码:
for (int i = 0;i < [self.campusBusArray count];i++)
{
NSLog(@"index at nsuinteger - %@", (NSUInteger)self.campusBusArray[i][@"StationIndex"]);
NSLog(@"index - %lu", index);
if ([(NSUInteger)self.campusBusArray[i][[@"StationIndex"] ]== index)
{
numberOfBusesCurrentlyAtThisStation++;
}
}
实际上StationIndex
是一个 1 或 2 位整数。比如我有self.campusBusArray[i][@"StationIndex"]
== 4,我有index
== 4,那么这两个 NSLog 都输出 4,但是不会跳转到 if 块,否则numberOfBusesCurrentlyAtThisStation++
不会执行。有人可以告诉我为什么吗?