我很确定这是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]; }
在很多成功和失败的情况下观察用户界面之后,在构图视图中看起来是一种竞争条件,这种情况因操作系统受到压力而加剧 – 不确定它是内存还是cpu压力(或两者兼而有之?).在任何情况下,当发送成功时,在选择联系人之后立即用其相应会话的内容填充消息信道的内容,明显地将新消息附加到结尾.但是当错误表面和消息消失时,对话的先前消息通常仅在按下发送按钮后才出现,而不显示新消息.如果这确实是竞争条件,那么一个猜测是它是作曲家VC的消息提取机制和-viewDidLoad之间的竞赛.
有没有人在此之前遇到过这种情况并且/或者知道某种解决方法?我将向苹果提交一份错误报告,但我想找到一个不包括等待Apple修复的解决方案.
笔记:
>消息在iPhone 4和iPhone 5s上消失最频繁,但在iPod touch第5代(全部运行iOS 7.0.2)上很少消失.
>使用iPhone 4上的https://github.com/timcour/mf-message-compose-fail-demo.git应用程序,通过尽可能快地将20张图像发送给同一个人,可以最轻松地再现该错误.
>有一个单独的(但可能是相关的)错误.在MFMCVC视图中选择输入联系人的电子邮件地址后,vc将确定是否应发送iMessage或MMS.在测试期间的某些时间,它做出了错误的决定,并尝试将消息作为MMS发送,尽管收件人iMessage帐户没有与之关联的电话号码.这导致向发件人发送一条消息,就像它已成功发送,但实际上未能到达目的地.
>这似乎不是许多用户向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