-2
- (IBAction)SendTxt:(id)sender {
MFMessageComposeViewController *textComposer = [[MFMessageComposeViewController alloc] init];
[textComposer setMessageComposeDelegate:self];
if ([MFMessageComposeViewController canSendText]) {
[textComposer setRecipients:[NSArray arrayWithObjects:@"123456",@"123456", nil]];
[textComposer setBody:@"HELP ME"];
[self presentViewController:textComposer animated:YES completion:NO];
}
else {
NSLog(@"Can't open Text");
}
}
-(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
switch (result) {
case MessageComposeResultSent:
NSLog(@"SENT");
break;
case MessageComposeResultFailed:
NSLog(@"FAILED");
break;
case MessageComposeResultCancelled:
NSLog(@"CANCELLED");
break;
default:
break;
}
}
我上面的代碼,它會彈出短信界面爲正常.. 它工作正常,併發送短信,但是短信發送窗口或取消後不會關閉後.. NSLog註冊發送或取消,但SMS窗口不會消失!短信窗口不會關閉或發送短信取消
任何人都可以幫忙嗎? 感謝 墊
感謝您的快速回復自己解僱,但我會在哪裏把這個?另外我只是想讓它關閉窗口,並在之前的頁面上! (我是小白) – MHG
switch(result){ case MessageComposeResultSent: NSLog(@「SENT」); [self dismissViewControllerAnimated:YES completion:nil]; 休息; case MessageComposeResultFailed: NSLog(@「FAILED」); [self dismissViewControllerAnimated:YES completion:nil]; 休息; case MessageComposeResultCallled: [self dismissViewControllerAnimated:YES completion:nil]; NSLog(@「CANCELLED」); 現在所有的作品都很棒! – MHG
-2?我不明白? – MHG