簡體   English   中英

MFMessageComposeViewController無法發送

[英]MFMessageComposeViewController fails to send

我想讓用戶通過短信發送電話驗證文字。 他們第一次嘗試將消息發送到數字時,看起來消息通過,我們得到MessageComposeResultSent的回調。 但是,實際上沒有消息排隊或發送。 看看iMessage,列表頂部有一個電話號碼記錄,但沒有消息,只是一個空白屏幕。 如果再次嘗試將SMS發送到相同的號碼,則會通過。 實現看起來很簡單,所以不確定這是一個錯誤還是我做錯了什么。

這是我們的代碼:

MFController = [[MFMessageComposeViewController alloc] init];

if([MFMessageComposeViewController canSendText])
{

    self.MFController.body = [NSString stringWithFormat:@"Please send this message to verify your phone number.\n\n(%@)",token];
    self.MFController.recipients = [NSArray arrayWithObject:@"+PHONENUMBER"];
    self.MFController.messageComposeDelegate = self;    
    [self presentViewController:MFController animated:YES completion:nil];
}

我已經嘗試直接在方法中聲明MFController,作為一個強大的屬性。 我也試過在ViewDidLoad中初始化MFController無濟於事。

更新:我並不孤單。 關於Apple Dev Forum的最新帖子。 如果有人有創意解決方案,請發布!

此外,重新啟動手機似乎解決了大多數用戶的問題,但是我們無法處理發送失敗,因為我們正在接收MessageComposeResultSent結果。

你是否符合代表的要求?

如果您將實例創建為屬性,則通過self訪問它,

self.MFController = [[MFMessageComposeViewController alloc] init];

    if([MFMessageComposeViewController canSendText])
    {

        self.MFController.body = [NSString stringWithFormat:@"Please send this message to verify your phone number.\n\n(%@)",token];
        self.MFController.recipients = [NSArray arrayWithObject:@"+PHONENUMBER"];
        self.MFController.messageComposeDelegate = self;    
        [self presentViewController:self.
MFController animated:YES completion:nil];
    }

如果有效,請告訴我。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM