我是新來這個,MailCompositionService意外退出IOS
我在我的viewController這段代碼,
- (void)sendMail:(id)sender {
NSArray *to = [NSArray arrayWithObjects:@"[email protected]", nil];
mailComposer = [[MFMailComposeViewController alloc] init];
mailComposer.mailComposeDelegate = self;
[mailComposer setToRecipients:to];
[mailComposer setSubject:@"Test Mail"];
[mailComposer setMessageBody:@"Testing message body" isHTML:NO];
[self presentModalViewController:mailComposer animated:YES];
}
#pragma mark - mail compose delegate
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
if(result) {
NSLog(@"Result = %d", result);
}
if(error) {
NSLog(@"Error = %@", error);
}
[self dismissModalViewControllerAnimated:YES];
}
但是,當我在我的控制器點擊發送按鈕,我得到的錯誤一樣,
2016-09-05 14:55:24.488 mailDemo[1276:104171] viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} 2016-09-05 14:55:24.989 mailDemo[1276:104171] Trying to dismiss the presentation controller while transitioning already. (<_UIFullscreenPresentationController: 0x7fe35b52d2a0>) 2016-09-05 14:55:24.991 mailDemo[1276:104171] transitionViewForCurrentTransition is not set, presentation controller was dismissed during the presentation? (<_UIFullscreenPresentationController: 0x7fe35b52d2a0>)
問題是什麼?
請在設置應用程序中檢查您的設備登錄郵件。 –
檢查後是否可以呈現郵件撰寫控制器,然後在設備中使用郵件配置進行測試。 –
我正在模擬器中測試它。 @BhadreshKathiriya – KAR