簡體   English   中英

MFMessageComposeViewController消息消失,並在按下發送按鈕后無法發送(iOS 7)

[英]MFMessageComposeViewController messages disappear and fail to send after send button is pressed (iOS 7)

我有一個應用程序,用戶可以在其中選擇圖像並將其附加到MFMessageComposeViewController實例,並將其發送給朋友。 在MFMCVC視圖中按send之后,某些時候事情會按預期進行-帶有圖像的消息已成功發送到收件人,或者在本機iMessage客戶端中,消息旁邊顯示了“消息失敗”標簽(但在在這兩種情況下,該圖像在本機客戶端中都是可見的。 但是,在按下send后(在運行iOS 7的iPhone 4上)大約有一半的時間會發生錯誤。 信息-附着和所有-消失了,再也不會被看到。 收件人永遠不會收到消息它也不會出現在iMessage的發件人的消息通道中。

我相當確定這是Apple MFMessageComposeViewController本身的錯誤,因為該API非常簡單,而且我能夠在單獨的演示應用程序https://github.com/timcour/mf-message-compose-中可靠地重現該錯誤。 fail-demo.git

- (void)displaySMSComposerSheet
{
    MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
    picker.messageComposeDelegate = self;

    NSData *data = [_imageDataCache objectForKey:[_imageURLs objectAtIndex:_currentIndex]];
    [picker addAttachmentData:data
               typeIdentifier:(NSString *)kUTTypeGIF
                     filename:@"share.gif"];
    if (![self.recipientTextField.text isEqualToString:@""]) {
        picker.recipients = [NSArray arrayWithObject:self.recipientTextField.text];
    }
    picker.body = [NSString stringWithFormat:@"image: %i", _currentIndex];

    [self presentViewController:picker animated:YES completion:NULL];
}

在相當多的成功和失敗案例中觀察了UI之后,在組合視圖中,這似乎是一種競爭條件,這是由於OS處於壓力之下而加劇的-不確定是內存還是CPU壓力(或兩者兼而有之?)。 無論如何,當發送成功時,選擇聯系人后立即在消息通道的內容中填充其各自對話的內容,並將新消息明顯地附加到末尾。 但是,當錯誤浮出水面並且消息消失時,對話的先前消息通常僅在按下發送按鈕之后才會出現,而不會出現新消息。 如果這確實是一個競爭條件,則可能是這是作曲家VC的消息獲取機制與-viewDidLoad之間的-viewDidLoad

是否有人在此之前遇到過和/或知道解決方法? 我將向Apple提交錯誤報告,但我想找到一個不包括等待Apple修復的解決方案。

筆記:

  • 消息在iPhone 4和iPhone 5s上消失最頻繁,但在iPod touch第5代(均運行iOS 7.0.2)上很少消失。

  • 通過將20張圖片盡快發送給同一個人,可以在iPhone 4上使用https://github.com/timcour/mf-message-compose-fail-demo.git應用程序最輕松地重現該錯誤。

  • 有一個單獨的(但可能相關)錯誤。 在MFMCVC視圖中選擇輸入聯系人的電子郵件地址后,vc決定應發送iMessage還是MMS。 在測試過程中的某些時候,盡管收件人iMessage帳戶沒有與之關聯的電話號碼,但它還是做出了錯誤的決定,並嘗試以MMS形式發送消息。 這導致了一條消息,該消息在發送方看來就像已成功發送,但實際上未到達其目的地。

  • 這似乎不是許多用戶向Apple抱怨的“ iMessage無法發送消息”錯誤。

更新:

這是消息消失且發送失敗時記錄的堆棧跟蹤:

Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] ****** Failed to complete all history queries in a blocking request: (
        "********-****-****-****-************"
    )
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 1   IMFoundation                        0x0000000193acb948 IMLogBacktraceToDepth + 80
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 2   IMCore                              0x00000001939d1df8 _NSStringFromIMMessageError + 22604
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 3   IMCore                              0x00000001939c7670 IMPersonStatusComparator + 261116
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 4   ChatKit                             0x00000001923c96b8 <redacted> + 240
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 5   ChatKit                             0x00000001923933b0 <redacted> + 88
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 6   ChatKit                             0x000000019237cb70 <redacted> + 996
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 7   ChatKit                             0x0000000192414cdc <redacted> + 76
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 8   Foundation                          0x000000018e8c0834 __NSFireDelayedPerform + 392
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 9   CoreFoundation                      0x000000018dd1768c <redacted> + 28
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 10  CoreFoundation                      0x000000018dd172fc <redacted> + 804
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 11  CoreFoundation                      0x000000018dd15024 <redacted> + 1324
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 12  CoreFoundation                      0x000000018dc55b78 CFRunLoopRunSpecific + 452
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 13  GraphicsServices                    0x0000000193677830 GSEventRunModal + 168
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 14  UIKit                               0x0000000190c9305c UIApplicationMain + 1156
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 15  MessagesViewService                 0x000000010009bd80 MessagesViewService + 15744
Oct 21 12:09:17 Davids-iPhone MessagesViewService[2680] <Warning>: [Warning] 16  libdyld.dylib                       0x000000019a25baa0 <redacted> + 4
Oct 21 12:09:20 Davids-iPhone SpringBoard[16] <Warning>: LICreateIconForImage passed NULL CGImageRef image

您的問題是您沒有對Picker的強烈引用。 將其設為一個ivar,並在選擇器完全完成其工作后將其設置為零。

嘗試確保您的時間和日期設置正確。 我更改了我的軟件以下載模擬器,卻忘記了將其改回。 然后我的消息開始消失。 確定時間后,問題已得到糾正。 干杯

暫無
暫無

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

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