【发布时间】:2016-01-30 02:19:44
【问题描述】:
我使用 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++不会被执行。谁能告诉我为什么?
【问题讨论】:
标签: objective-c int jsonmodel nsuinteger