I'm trying to add objects that are in an array to an NSDictionary based on their position inside of the NSArray, but the app crashes as soon as the NSDictionary is allocated. Any ideas why?
NSString *venue_title = [venues objectAtIndex:[actionSheet tag]];
NSString *venue_address = [venues_full_address objectAtIndex:[actionSheet tag]];
NSString *venue_lat = [venues_lat objectAtIndex:[actionSheet tag]];
NSString *venue_lng = [venues_lng objectAtIndex:[actionSheet tag]];
NSLog(@"%@, %@, %@, %@", venue_title, venue_address, venue_lat, venue_lng);
NSDictionary *venue_details_dict = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects:venue_title, venue_address, venue_lat, venue_lng, nil] forKeys:[NSArray arrayWithObjects:@"name", @"address", @"lat", "lng", nil]];
I see all the right values when I NSLog the objects, but the NSDictionary makes the app crash with a EXC_BAD_ACCESS error. I have NSZombies enabled, but nothing is being shown when it crashes like it would regularly show. Any ideas on what's going on here? Thanks in advance!
NSDictionary *venue_details_dict = [[NSDictionary alloc] initWithObjects:
[NSArray arrayWithObjects:venue_title, venue_address, venue_lat, venue_lng, nil]
forKeys:
[NSArray arrayWithObjects:@"name", @"address", @"lat", "lng", nil]];
You forgot the @ on "lng". Boom.
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