I tried to show system defined viewcontrollers (MFMailComposeViewController, TWTweetComposeViewController,etc..) as a modal view.
But these viewcontrollers dosn't appear in iOS 7(these run in iOS5,iOS6).
Viewcontrollers created by me appear in iOS7(ex.HogeViewController).
I don't call presentViewController:animated:completion
at viewDidLoad
or viewWillAppear
.
Does anybody have an idea?
Console logs:
init Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)"
or
_serviceViewControllerReady:error: Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)"
or
Unbalanced calls to begin/end appearance transitions for .
TWTweetComposeViewController(doesn't appear)
TWTweetComposeViewController *viewController = [[TWTweetComposeViewController alloc]init];
viewController.completionHandler = ^(TWTweetComposeViewControllerResult result){
NSLog(@"Result : %d",result);
};
[self presentViewController:viewController animated:YES completion:NULL];
Log
Result : 0
MFMailComposeViewController(appears a moment and dismiss soon)
- (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);
}];
}
Log
_serviceViewControllerReady:error: Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)"
Unbalanced calls to begin/end appearance transitions for .
error:(null),result:0
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…