0

I am getting an issue in assigning the MKMapView object to view,

UIView *tempView = [[UIView alloc]initWithFrame:CGRectMake(1, 102, 318, 377)];
[self.view addSubview:tempView];
lMapViewTemp = [[MKMapView alloc]initWithFrame:CGRectMake(0, 0, 318, 377)];
lMapViewTemp.delegate = self;

Issue at this line:

[tempView addSubview:lMapViewTemp];   EXC_BAD_ACCESS (Code=1,address=0xc)

When I call the above structure once, Its working fine. And after,

//calling for add contact
- (IBAction)BnEditContact:(id)sender{
    UIButton *button = sender;
    buttonTag = (int)button.tag;
    if(!picker){
        picker=[[ABPeoplePickerNavigationController alloc] init];
    }
    picker.peoplePickerDelegate = self;
    [self presentViewController:picker animated:YES completion:nil];
}

-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
     shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property
                             identifier:(ABMultiValueIdentifier)identifier{
    [self dismissViewControllerAnimated:YES completion:nil];
    return NO;
}

//delegate methods
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person;
{
    [self displayPerson:person];
}

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
    //calls displayPerson:(ABRecordRef)person to show contact's information in the app
    [self displayPerson:person];
    [self dismissViewControllerAnimated:NO completion:NULL];
    return NO;
}

I am receiving contacts from the above code. Now, If i again try to access the mapView. Its raising Issue.

Alex Andrews
  • 1,498
  • 2
  • 19
  • 33
  • Not sure if related but see this question and accepted answer on it: http://stackoverflow.com/questions/20687173/crash-when-loading-mkmapview –  Nov 26 '14 at 12:53
  • I have gone through this link, Even, I deallocated the ABPeoplePickerNavigationController. – sai_katteboina Nov 26 '14 at 13:14
  • Did you try using the `+sharedPeoplePicker` method from this question: http://stackoverflow.com/questions/20146979/app-crash-on-use-of-peoplepicker-but-not-in-same-view –  Nov 26 '14 at 14:14

0 Answers0