5

Tôi gặp vấn đề lạ khi tôi chỉ đang thực hiện một bộ điều khiển chế độ xem đơn giản. MFMailComposeViewController chính xác. Tuy nhiên, nó xuất hiện phía sau trình điều khiển trình bày và do đó bạn không thể gửi bất kỳ email hoặc loại nào. Bạn có thể thấy nút "Hủy" trên UINavigationBar trên trình soạn thư, nhưng bật ra UIAlertController phía sau trình điều khiển trình bày. Chuyện này đã xảy ra như thế nào? Đây có phải là sự cố iOS 11 không? Tôi cũng nhận được hành vi tương tự cho UIAlertController s.iOS 11 presentViewController đi phía sau trình bày bộ điều khiển

Ngoài ra, nếu tôi nhấn gửi và nhấn nút để bật lên một Trình soạn nhạc khác, nó hoạt động như bình thường. Nó chỉ là cái đầu tiên.

Vui lòng xem hình ảnh đính kèm mà tôi nhận được từ Xcode.

enter image description here

MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; 
mailer.mailComposeDelegate = self; 
mailer.modalPresentationStyle = UIModalPresentationFormSheet; 
[mailer setSubject:@"subject Feedback"]; 
[mailer setToRecipients:@[@"email address"]]; 
[mailer setMessageBody:@"" isHTML:NO]; 
[self presentViewController:mailer animated:YES completion:nil]; 

Chỉnh sửa: Thêm bộ điều khiển để biết thêm thông tin.

#import "AboutViewController.h" 
#import <MessageUI/MessageUI.h> 


@interface AboutViewController() <MFMailComposeViewControllerDelegate> 
@property (nonatomic, strong) IBOutlet UIView *contentView; 
@end 

@implementation AboutViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    self.title = @"About this app"; 
    _contentView.layer.cornerRadius = 10.; 
    _contentView.layer.shadowColor = [UIColor blackColor].CGColor; 
    _contentView.layer.shadowRadius = 3.; 
    _contentView.layer.shadowOpacity = 0.4; 
    _contentView.layer.shadowOffset = CGSizeMake(3., 3.); 
    // Do any additional setup after loading the view from its nib. 
} 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

- (IBAction)sendFeedbackEmail:(id)sender { 
    if ([MFMailComposeViewController canSendMail]){ 
     dispatch_async(dispatch_get_main_queue(), ^{ 
      MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; 
      mailer.mailComposeDelegate = self; 
      mailer.modalPresentationStyle = UIModalPresentationFormSheet; 
      [mailer setSubject:@"Feedback"]; 
      [mailer setToRecipients:@[@"[email protected]"]]; 
      [mailer setMessageBody:@"" isHTML:NO]; 
      [self presentViewController:mailer animated:YES completion:nil]; 

     }); 
    } else { 
     NSLog(@"Nope"); 
    } 
} 

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{ 
    [controller dismissViewControllerAnimated:YES completion:nil]; 
} 

Chỉnh sửa 2:

Tôi tin rằng tôi đã tìm thấy câu trả lời. Tôi hy vọng điều này có thể giúp bất kỳ ai gặp phải vấn đề tương tự. Cảm ơn tất cả các bài trả lời, nó đã giúp tôi tìm ra câu trả lời. Cảm ơn bạn @ Mert Buran cho ý tưởng đại biểu. Điều này cho tôi thấy rằng lần đầu tiên nó có một sự chuyển tiếp khác nhau được ủy nhiệm và lần đầu tiên tôi muốn lần thứ hai.

Vấn đề là navigationController đã đẩy bộ điều khiển mới trước khi loại bỏ bộ điều khiển tôi có trên đầu (trình điều khiển menu). Một sửa chữa đơn giản nhưng bởi vì nó không phải là hiển nhiên lúc bắt đầu và không có bản ghi lỗi, nó đã được khó khăn để pin điểm.

+0

Ngoài ra tôi đã đặt chủ đề này vào chủ đề chính để tránh bất kỳ sự nhầm lẫn nào – mashdup

+0

Bạn có thể tải dự án của mình lên Github không? – LinusGeffarth

+0

Thật không may là tôi không thể. Nhưng tôi sẽ phải sử dụng một giải pháp khác, cảm ơn vì đã tìm kiếm – mashdup

Trả lời

Các vấn đề liên quan