Hi there
I don't know why I'm getting this error. I'm also getting an EXC_BAD_ACCESS issue from the following code. Any ideas why?
Running breakpoints on the didRecieveResponse
and didRecieveData
and didFinishLoading
shows the first two get run and mid way through recieving data the program crashes.
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
// starts... :)
plistContentsData = [NSMutableData data]; //NSMutableData - inst in head
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[plistContentsData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
mellowListings = [[NSArray alloc] initWithData:plistContentsData]; //NSArray - inst in head
NSLog(@"%@",mellowListings);
CLLocationCoordinate2D newLocation;
int counter = 0;
for(NSDictionary *tempDict in mellowListings){
NSLog(@"%f",([[tempDict objectForKey:@"lat"] floatValue]));
NSLog(@"%f",([[tempDict objectForKey:@"long"] floatValue]));
newLocation.latitude = ([[tempDict objectForKey:@"lat"] floatValue]);
newLocation.longitude = ([[tempDict objectForKey:@"long"] floatValue]);
TCPlaceMarker *placemark = [[TCPlaceMarker alloc] initWithCoordinate:newLocation];
placemark.title = [tempDict objectForKey:@"name"];
placemark.subtitle = [tempDict objectForKey:@"address1"];
placemark.source = [[tempDict objectForKey:@"source"] lowercaseString];
placemark.tag = counter;
[mapView addAnnotation:placemark];
counter++;
}
}