【发布时间】:2013-09-29 12:10:14
【问题描述】:
我尝试将系统定义的视图控制器(MFMailComposeViewController、TWTweetComposeViewController 等)显示为模式视图。
但这些视图控制器不会出现在 iOS 7 中(它们在 iOS5、iOS6 中运行)。
我创建的视图控制器出现在 iOS7(ex.HogeViewController)中。
我不会在viewDidLoad 或viewWillAppear 打电话给presentViewController:animated:completion。
有人有想法吗?
控制台日志:
init Error Domain=NSCocoaErrorDomain Code=4097 "操作无法完成。(Cocoa 错误 4097.)"
或
_serviceViewControllerReady:error: Error Domain=NSCocoaErrorDomain Code=4097 “操作无法完成。(Cocoa 错误 4097。)”
或
开始/结束外观转换的不平衡调用。
TWTweetComposeViewController(不出现)
TWTweetComposeViewController *viewController = [[TWTweetComposeViewController alloc]init];
viewController.completionHandler = ^(TWTweetComposeViewControllerResult result){
NSLog(@"Result : %d",result);
};
[self presentViewController:viewController animated:YES completion:NULL];
日志
结果:0
MFMailComposeViewController(出现片刻并很快消失)
- (void)send:(NSString*)email{
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSArray *toRecipients = @[email];
[picker setToRecipients:toRecipients];
[picker setSubject:@"Subject"];
[picker setMessageBody:@"Body" isHTML:NO];
[self.navigationController presentViewController:picker animated:YES completion:NULL];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"error:%@,result:%d",error.description,result);
}];
}
日志
_serviceViewControllerReady:error: Error Domain=NSCocoaErrorDomain Code=4097 “操作无法完成。(Cocoa 错误 4097。)” 开始/结束外观转换的不平衡调用。 错误:(空),结果:0
【问题讨论】:
-
有兴趣,请出示您的代码吗?
-
感谢您的评论。我编辑了问题。
-
你可以尝试设置动画:没有过渡?
-
TWTweetComposeViewController 没有区别。关于MFMailComposeViewController,不出现ViewController和crash(EXC_BAD_ACCESS)。
-
我遇到了完全相同的问题,但只是在 iPhone 上。 iPad 对我来说不会出现同样的问题。除非我听到其他消息,否则我相信这是一个 iOS 7 错误。如果在结束委托方法上设置断点,邮件控制器的结果是 MFMailComposeResultCancelled。