通过选择 iPhone 联系人列表中的电话号码打开消息编辑器

发布于 2024-11-16 22:23:28 字数 1319 浏览 1 评论 0原文

我陷入了这些问题。
我打开默认联系人列表,并尝试通过选择特定联系人的电话号码来打开消息编辑表。
但它关闭了我的应用程序并尝试给那个人打电话。
我做错了什么?
请告诉我。
这是我尝试打开消息框的地址簿委托方法的代码。

- (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;
}

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;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过去的过去 2024-11-23 22:23:28

返回 NO:

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

您返回 YES,iOs 认为您正在尝试从应用程序中调用它们。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文