I have changed my code to this way. Now mail controller is opening in landscape mode. But the problem is If I touch on cancel button or send button the mail controller is not dismissing its view. How can I do it ?
-(void)goToFirstScreen:(id)sender
{
NSLog(@"goToFirstScreen: ");
CCScene *Scene = [CCScene node];
CCLayer *Layer = [EmailScene node];
[Scene addChild:Layer];
[[CCDirector sharedDirector] setAnimationInterval:1.0/60];
[[CCDirector sharedDirector] pushScene: Scene];
}
Th EmailScene class is
#import "EmailScene.h"
#import "testOfEnd.h"
@implementation EmailScene
- (id) init {
self = [super init];
if (self != nil) {
[self displayComposerSheet];
}
return self;
}
-(void)displayComposerSheet
{
[[CCDirector sharedDirector] pause];
picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[[[CCDirector sharedDirector] openGLView] addSubview:picker.view];
[[CCDirector sharedDirector] stopAnimation];
[picker presentModalViewController:picker animated:YES];
[picker release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[[CCDirector sharedDirector] resume];
//dismiss view after otherwise the code is not executed
[picker.view removeFromSuperview];
[[CCDirector sharedDirector] startAnimation];
[picker dismissModalViewControllerAnimated:YES];
//return to previous scene
CCScene *Scene = [CCScene node];
CCLayer *Layer = [testOfEnd node];
[Scene addChild:Layer];
[[CCDirector sharedDirector] replaceScene:Scene];
}
@end
When I touch cancel button, in the log no message is displayed and the mail controller not dismissed.
But when I touch the send button, in the log
Error loading /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator: dlopen(/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator, 265): Library not loaded: /System/Library/PrivateFrameworks/MobileWirelessSync.framework/MobileWirelessSync Referenced from: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/DataClassMigrators/AccountMigrator.migrator/AccountMigrator Reason: image not found 2010-05-12 12:08:18.640 enemyTest2[1233:5717] [+[AccountsManager _migrateAccountsIfNeeded]] Accounts migration failed
What about this message , how can I dismiss model view controller.
Thank You.