Why does the following result in a BAD_ACCESS error?
NSDictionary *header=[[NSDictionary alloc]initWithObjectsAndKeys:@"fred",@"title",1,@"count", nil];
Can you have different types of objects as values in NSDictionary, including another NSDictionary?
You can put any type of object into an NSDictionary. So while @"fred" is OK, 1 is not, as an integer is not an object. If you want to put a number in a dictionary, wrap it in an NSNumber:
NSDictionary *header = { @"title": @"fred", @"count": @1 };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With