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 がある場合、2 つの NSLog はすべて 4 を出力しますが、if ブロックにジャンプしないか、numberOfBusesCurrentlyAtThisStation++
実行されません。誰かが私の理由を教えてもらえますか?