gpt4 book ai didi

ios - 按下发送按钮后,MFMessageComposeViewController 消息消失且无法发送(iOS 7)

转载 作者:可可西里 更新时间:2023-11-01 03:19:47 25 4
gpt4 key购买 nike

我有一个应用程序,用户可以在其中选择一个图像并将其发送给 friend ,方法是将图像附加到 MFMessageComposeViewController 的一个实例。在 MFMVCC View 中按下发送后,有时事情会按预期工作——带有图像的消息已成功发送给收件人,或者“消息失败”标签显示在 native iMessage 客户端中的消息旁边(但在在这两种情况下,图像都是在 native 客户端中可见)。但是,在按下发送后的一半时间内会出现一个错误(在运行 iOS 7 的 iPhone 4 上)。信息——依恋和一切——消失了,再也见不到了。收件人永远不会收到消息并且它不会出现在 iMessage 中发件人的消息 channel 中。

我相当确定这是 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 后,它似乎是 compose View 中的竞争条件,并且由于操作系统的压力而加剧——不确定是内存压力还是 CPU 压力(或两者兼而有之?)。在任何情况下,当发送成功时,消息 channel 的内容会在选择联系人后立即用其各自对话的内容填充,明显地将新消息附加到末尾。但是,当错误浮出水面并且消息消失时,对话的先前消息通常只会在按下发送按钮后出现,而不会出现新消息。如果这确实是一个竞争条件,一个猜测是它是 composer VC 的消息获取机制和 -viewDidLoad 之间的竞争。

有没有人以前遇到过这个问题和/或知道解决方法?我将向 Apple 提交错误报告,但我想找到一个不包括等待 Apple 修复的解决方案。

注意事项:

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

  • 使用 https://github.com/timcour/mf-message-compose-fail-demo.git 可以最轻松地重现错误尽快将 20 张图像发送给同一个人,从而在 iPhone 4 上安装应用程序。

  • 有一个单独的(但可能相关的)错误。在 MFMCVC View 中选择输入联系人的电子邮件地址后,vc 会确定是否应发送 iMessage 或 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

最佳答案

您的问题是您没有对选择器的强引用。将其设为 ivar,并在选择器完全完成其工作时将其置零。

关于ios - 按下发送按钮后,MFMessageComposeViewController 消息消失且无法发送(iOS 7),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19460885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com