为什么 MFMailComposeViewController 在 iOS 8.3 上崩溃?
Why is MFMailComposeViewController crashing on iOS 8.3?
我最近提交了一个应用程序以供审核,当收到一封电子邮件 link 时,该应用程序崩溃了。我在多个设备上尝试了几次,但无法重新创建它,但没有 iPad Air 2。但是,看起来它可能与未包含对 [=13 的检查有关=],虽然我不确定这是否会导致崩溃。谁能提供一些关于它崩溃原因的见解?谢谢!
在审查期间,您的应用在 iPad Air 2 运行 iOS 8.3 上崩溃,当时我们:
1. 按提供反馈按钮
这是错误日志:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
(0x1839bc2d8 0x1950dc0e4 0x18871ea98 0x188720934 0x1884ea158 0x1000bc128 0x188431404 0x18841a4e0 0x188430da0 0x188430a2c 0x188429f68 0x1883fd18c 0x18869e324 0x1883fb6a0 0x183974240 0x1839734e4 0x183971594 0x18389d2d4 0x18cf8b6fc 0x188462fac 0x1000bc6f0 0x19575aa08)
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000195873270 0x195858000 + 111216
1 libsystem_pthread.dylib 0x000000019591116c 0x19590c000 + 20844
2 libsystem_c.dylib 0x00000001957eab14 0x195788000 + 404244
3 libc++abi.dylib 0x00000001948a9414 0x1948a8000 + 5140
4 libc++abi.dylib 0x00000001948c8b88 0x1948a8000 + 134024
5 libobjc.A.dylib 0x00000001950dc3bc 0x1950d4000 + 33724
6 libc++abi.dylib 0x00000001948c5bb0 0x1948a8000 + 121776
7 libc++abi.dylib 0x00000001948c5738 0x1948a8000 + 120632
8 libobjc.A.dylib 0x00000001950dc290 0x1950d4000 + 33424
9 CoreFoundation 0x000000018389d380 0x183894000 + 37760
10 GraphicsServices 0x000000018cf8b6f8 0x18cf80000 + 46840
11 UIKit 0x0000000188462fa8 0x1883ec000 + 487336
12 b2bGatewayWebview 0x00000001000bc6ec 0x100098000 + 149228
13 libdyld.dylib 0x000000019575aa04 0x195758000 + 10756
代码:
- (IBAction)touchRequestEnhancement:(id)sender {
// Email Subject
NSString *emailTitle = @"iOS App Feedback";
// Email Content
NSString *messageBody = @"Enter message here";
// To address
NSArray *toRecipents = [NSArray arrayWithObject:@"xxxx@xxxx.com"];
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitle];
[mc setMessageBody:messageBody isHTML:NO];
[mc setToRecipients:toRecipents];
// Present mail view controller on screen
[self presentViewController:mc animated:YES completion:NULL];
}
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
// Close the Mail Interface
[self dismissViewControllerAnimated:YES completion:NULL];
}
写在 iPhone 上,请原谅我的简洁。保持对邮件控制器的强引用,直到最终委托回调。
我最近提交了一个应用程序以供审核,当收到一封电子邮件 link 时,该应用程序崩溃了。我在多个设备上尝试了几次,但无法重新创建它,但没有 iPad Air 2。但是,看起来它可能与未包含对 [=13 的检查有关=],虽然我不确定这是否会导致崩溃。谁能提供一些关于它崩溃原因的见解?谢谢!
在审查期间,您的应用在 iPad Air 2 运行 iOS 8.3 上崩溃,当时我们: 1. 按提供反馈按钮
这是错误日志:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
(0x1839bc2d8 0x1950dc0e4 0x18871ea98 0x188720934 0x1884ea158 0x1000bc128 0x188431404 0x18841a4e0 0x188430da0 0x188430a2c 0x188429f68 0x1883fd18c 0x18869e324 0x1883fb6a0 0x183974240 0x1839734e4 0x183971594 0x18389d2d4 0x18cf8b6fc 0x188462fac 0x1000bc6f0 0x19575aa08)
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000195873270 0x195858000 + 111216
1 libsystem_pthread.dylib 0x000000019591116c 0x19590c000 + 20844
2 libsystem_c.dylib 0x00000001957eab14 0x195788000 + 404244
3 libc++abi.dylib 0x00000001948a9414 0x1948a8000 + 5140
4 libc++abi.dylib 0x00000001948c8b88 0x1948a8000 + 134024
5 libobjc.A.dylib 0x00000001950dc3bc 0x1950d4000 + 33724
6 libc++abi.dylib 0x00000001948c5bb0 0x1948a8000 + 121776
7 libc++abi.dylib 0x00000001948c5738 0x1948a8000 + 120632
8 libobjc.A.dylib 0x00000001950dc290 0x1950d4000 + 33424
9 CoreFoundation 0x000000018389d380 0x183894000 + 37760
10 GraphicsServices 0x000000018cf8b6f8 0x18cf80000 + 46840
11 UIKit 0x0000000188462fa8 0x1883ec000 + 487336
12 b2bGatewayWebview 0x00000001000bc6ec 0x100098000 + 149228
13 libdyld.dylib 0x000000019575aa04 0x195758000 + 10756
代码:
- (IBAction)touchRequestEnhancement:(id)sender {
// Email Subject
NSString *emailTitle = @"iOS App Feedback";
// Email Content
NSString *messageBody = @"Enter message here";
// To address
NSArray *toRecipents = [NSArray arrayWithObject:@"xxxx@xxxx.com"];
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitle];
[mc setMessageBody:messageBody isHTML:NO];
[mc setToRecipients:toRecipents];
// Present mail view controller on screen
[self presentViewController:mc animated:YES completion:NULL];
}
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
// Close the Mail Interface
[self dismissViewControllerAnimated:YES completion:NULL];
}
写在 iPhone 上,请原谅我的简洁。保持对邮件控制器的强引用,直到最终委托回调。