Sunday 15 September 2013

iphone - Ios MFMailComposeViewController not displaing -


I'm trying to write Rhodes native extension extensions to open iOS MailComposer . Now the code "works", but MFMailComposeViewController is not displayed and shows the encoded warning:

  attempt to render & lt; MFMailComposeViewController: 0x12b60840 & gt; On & lt; Iosmailto: 0xc1898d0 & gt; Whose view is not in the window hierarchy!   

I have read that UIViewControllers should be in the hierarchy, but I can not provide it with Rhodes Ruby Code or explicit extensions cover. So far I UIViewController and MFMailComposeController with [UIApplication sharing application] .keyWindow.rootViewController trying to put me, but mail composer now Not showing.

Interface from iosmailto.h: @interface Iosmailto: UIViewController & lt; MFMailComposeViewControllerDelegate & gt; {} @property (non-nomic, assigned) ID representative; // - (IBAction) send_mail: (id) this; @end

Implementation from iosmailto.m:

  @implementation Iosmailto - (zero) viewDidload {{Super Viewedload]; [Self-paced_mail]; } - (void) send_mail {if ([MFMailComposeViewController canSendMail]) {MFMailComposeViewController * composer = [[MFMailComposeViewController alloc] init]; Composer.mailComposeDelegate = self; [Composer set theme: [NSString string withUTF8String: subj]]; NSArray * recipient_array = [NSArray arrayWithObject: [NSString string withUTF8 string: recipient]] ;; [Composer Settreippian: Recipient_Are]; NSString * composerBody = [NSString string withUTF8 string: message]; [Composer set message body: Composer Body is HTML: No]; [Composer setmodel transition style: UimodalTransitionStyleCrossDissolve]; [Self-Present Model Viewer: Animator Animator: Yes]; [Composer release]; } Other {nslog (@ "device is unable to send email in its current state."); }} / * For this question, some unnecessary * / @end   

and Iosmailto.m Rhodes defined in C function has been told:

  // root vc UIViewController * topController = [UIApplication Sharing Application] .keyWindow.rootViewController; // Find Top VC (topController.presentedViewController) {topController = topController.presentedViewController; } Iosmailer = [[Iosmailto alloc] init]; Iosmailer.delegate = topController; [Controller present ViewController: animated iosmailer: yes complete: zero];   

  - (id) init {self = [super initWithNibName: zero bundle:  

Updates zero]; Self return; }

From Update 2 This address is a shortened version (without Uaiviaiuaiuti controller casing) was my starting point that do not work and a warning and Another is:

  UIViewController * topController = [UIApplication shared application] .keyWindow.rootViewController; While (topController.presentedViewController) {topController = topController.presentedViewController; } If ([MFMailComposeViewController canSendMail]) {MFMailComposeViewController * composer = [[MFMailComposeViewController alloc] init]; Composer.mailComposeDelegate = (id & lt; MFMailComposeViewControllerDelegate & gt;) topController; [Composer set theme: [NSString string withUTF8String: subj]]; NSArray * recipient_array = [NSArray arrayWithObject: [NSString string withUTF8 string: recipient]] ;; [Composer Settreippian: Recipient_Are]; NSString * composerBody = [NSString string withUTF8 string: message]; [Composer set message body: Composer Body is HTML: No]; [Composer setmodel transition style: UimodalTransitionStyleCrossDissolve]; [Top Controller Current Model View Controller: Animated Animator: Yes]; [Composer release]; } Else {}    

Use this code to present the view controller

  [[[[[UIApplication shared application] delegate] window] Rutwukantrolr] present Vikantrolr: Composer animated: Yes full minus];     

No comments:

Post a Comment