0

I stuck in issue with these.
I open default contact list and try to open message composer sheet by selection phone number of particular contact.
But it close my app and try to call that person instead.
What i am doing wrong?
Please let me know.
This is my code of delegate method of address book from which i try to open message box.

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
    Class msgClass = (NSClassFromString(@"MFMessageComposeViewController"));
    if (msgClass != nil)
    {
        // We must always check whether the current device is configured for sending messages
        if ([msgClass canSendText])
        {
            [self showComposerforMessage];
            [self dismissModalViewControllerAnimated:TRUE];
        }
        else
        {
            UIAlertView *objAlert=[[UIAlertView alloc]initWithTitle:@"" message:@"Device is not configured to send text message." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            [objAlert show];
            [objAlert release];
        }
    }
    else
    {
        UIAlertView *objAlert=[[UIAlertView alloc]initWithTitle:@"" message:@"Device is not configured to send text message." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [objAlert show];
        [objAlert release];
    }
    return TRUE;
}
dks1725
  • 1,631
  • 1
  • 20
  • 29

1 Answers1

0

Return NO there:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier

You return YES and iOs thinks thet you are trying to call from your application.

VictorT
  • 783
  • 10
  • 20