I am not sure if I understand MFMailComposeViewController
correctly. I am expecting a viewcontroller with an existing view to show up on my screen. I can see the FTViewController's view. But the mail composer never appears.
I have simplified the original question to a bare minimum.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
FTViewController *vc = [[FTViewController alloc]init];
self.window.rootViewController = vc;
..
}
In FTViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
FTTest *test = [[FTTest alloc] init];
[test testmeup];
}
FTTest:
#import <MessageUI/MessageUI.h>
@interface FTTest : UIViewController <MFMailComposeViewControllerDelegate>
@implementation FTTest
- (void)testmeup
{
BOOL ok = [MFMailComposeViewController canSendMail];
if (!ok)
return;
MFMailComposeViewController* vc = [MFMailComposeViewController new];
vc.mailComposeDelegate = self;
[self presentViewController:vc animated:YES completion:nil];
}