The JSON that I am parsing can be found here 'redacted'.
I can correctly grab all of the objects from this JSON except notifications and devices. I am having a lot of trouble being able to get the array of device dictionaries containing 'deviceId's. My code right now looks like this
dispatch_async(kBgQueue, ^{
NSData* data = [NSData dataWithContentsOfURL:
iViuListOfCustomersURL];
[self performSelectorOnMainThread:@selector(fetchedData:)
withObject:data waitUntilDone:NO];
});
- (void) fetchedData:(NSData *)responseData {
NSError* error;
NSDictionary* json;
json = [NSJSONSerialization
JSONObjectWithData:responseData // 1
options:kNilOptions
error:&error];
NSArray* customers = json;
for(int i = 0; i < customers.count ; i++){
NSDictionary *customer = [customers objectAtIndex:i];
cmsServer = [customer objectForKey:@"cmsServer"];
iconUrl = [NSURL URLWithString:[customer objectForKey:@"iconUrl"]];
wideLogo = [customer objectForKey:@"wideLogo"];
customerNo = [NSNumber numberWithInt:[[customer objectForKey:@"customerNo"] intValue]];
placeName = [customer objectForKey:@"placeName"];
distance = [NSNumber numberWithFloat:[[customer objectForKey:@"distance"] floatValue]];
placeId = [NSNumber numberWithInt:[[customer objectForKey:@"placeId"] intValue]];
address = [customer objectForKey:@"address"];
cmsName = [customer objectForKey:@"cmsName"];
hasLocations = [NSNumber numberWithInt:[[customer objectForKey:@"hasLocations"]intValue]];
isFavorite = [NSNumber numberWithInt:[[customer objectForKey:@"isFavorite"] intValue]];
longitude = [NSNumber numberWithFloat:[[customer objectForKey:@"longitude"] floatValue]];
latitude = [NSNumber numberWithFloat:[[customer objectForKey:@"latitude"] floatValue]];
hasArtifacts = [NSNumber numberWithInt:[[customer objectForKey:@"hasArtifacts"]intValue]];
// I have tried a number of things and this was what I had for the last try.
devices = [NSArray arrayWithObject:[customer objectForKey:@"devices"]];
NSLog(@"%@",devices.count);
}
}
I am relatively new to objective-c and wanted to figure this out on my own but I have spent too much time on this issue and I cannot continue without these device IDs.
Thank you!