I use JSONModel to capture data from 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
And I have the following code:
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++;
}
}
Actually StationIndex
is a 1 or 2 digit integer. For example I have self.campusBusArray[i][@"StationIndex"]
== 4, and I have index
== 4, then the two NSLog all output 4, but it will not jump into the if block, or the numberOfBusesCurrentlyAtThisStation++
won't be executed. Can somebody tell my why?