Class member var named “id” below is of type int. Need to set from a dictionary object.
Tried type casting (int)[tip objectForKey:@”id”] did not return the correct integer value. Can someone help?
Thanks
for (NSDictionary *t in tips) {
//prints 5876 which is correct
NSLog(@"id: %@",[t objectForKey:@"id"]);
Tip *myTip = [[Tip alloc] init];
// returns incorrect integer value
[myTip setId:(int)[tip objectForKey:@"id"]];
}
Try