MFMessageComposeViewController much slower on iOS 7

前端 未结 3 2169
别那么骄傲
别那么骄傲 2021-02-14 15:20

I\'ve an app for sending email and text messages.

The problem that i\'m having is that the loading of the MFMessageComposeViewController much slower on iOS 7 than it was

3条回答
  •  名媛妹妹
    2021-02-14 15:24

    I have the same problem. I made the composer strong reference with

    @property (nonatomic, strong, retain) MFMessageComposeViewController *messageComposer;
    

    Then owner class calls this method:

    -(void)sendSMSFromController:(UIViewController*)controller
    {
        self.messageComposer = [MFMessageComposeViewController new];
    
        if([MFMessageComposeViewController canSendText]) {
            [_messageComposer setBody:_body];
            [_messageComposer setRecipients:[NSArray arrayWithObjects:_recipient, nil]];
            [_messageComposer setMessageComposeDelegate:self];
            [controller presentViewController:_messageComposer animated:NO completion:NULL];
        }
    }
    

    Composer appears quickly but disappears slowly. Finalizes with:

    - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
    {
        switch (result) {
            case MessageComposeResultCancelled:
                NSLog(@"Message sending cancelled.");
                break;
    
            case MessageComposeResultFailed:
                NSLog(@"Message sending failed.");
                break;
    
            case MessageComposeResultSent:
                NSLog(@"Message sent.");
            default:
                break;
        }
    
    
        [controller dismissViewControllerAnimated:YES completion:^(){
            self.messageComposer = nil;
        }];
    }
    

    After restarting my device it clearly works. Before restart (after messing with MessageService by sending invalid recipients) it failed.

提交回复
热议问题