gpt4 book ai didi

ios - MFMessageComposeViewController 取消按钮不起作用

转载 作者:行者123 更新时间:2023-11-30 13:57:12 25 4
gpt4 key购买 nike

我使用这个 block 向联系人发送消息,发送后,后退按钮在那里,但是当我触摸它时没有任何反应。请帮帮我:)

-(IBAction) InviteIt:(id) sender{


if ([MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *messageComposer =
[[MFMessageComposeViewController alloc] init];
messageComposer.messageComposeDelegate = self;
NSString *message = @"You have more body buddies than you think at: http://www.itunes.com/app/JoyChain ";
[messageComposer setBody:message];
messageComposer.recipients = [NSArray arrayWithObjects:_itsnum, nil];
messageComposer.messageComposeDelegate = self;
[self presentViewController:messageComposer animated:YES completion:nil];

}

}

最佳答案

您是否忘记实现mailComposeController:didFinishWithResult:?...

- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}

// Close the Mail Interface
[controller dismissViewControllerAnimated:YES completion:nil];
}

来自苹果文档:

// The mail compose view controller delegate method
- (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
[self dismissModalViewControllerAnimated:YES];
}

但是您可以根据您的目标处理所有情况...

关于ios - MFMessageComposeViewController 取消按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33465257/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com