MFMailComposeViewController iOS9 bug (on iPad mini 4) - ios

I think there's an issue with the MFMailComposeViewController in iOS9, at least on my new iPad mini 4.
Even using the simplest test code I doesn't work. For example, using:
if(![MFMailComposeViewController canSendMail]) {
return;
}
MFMailComposeViewController *controller = [MFMailComposeViewController new];
controller.mailComposeDelegate = self;
[controller setSubject:#"Test"];
[controller setMessageBody:#"Test" isHTML:FALSE];
[self presentViewController:controller animated:TRUE completion:^{
}];
The App becomes completely unresponsive, NOTHING happens on the screen, I see no draft e-mail or something like that.
Important things to know:
YES, my device can send mail, I've used the default canSendMail check
I've tried strong-referencing the controller but it had no effect
The exact same code works perfectly on another iPad running iOS8
In the simulator it DOES show the draft but closes immediately saying that "MailCompositionService suddenly quit"
Anybody any ideas?

Ok I created a complete barebone test-App and found out it DID work there so something else was the issue. I finally discovered the issue was that the App showed a tableview with about 50 rows (I did use recycling) but that created a memory issue... (I did check with Instruments but no leaks).
Anyway, I found out if I present the mailcontroller when NOT also showing the tableview it had no issues at all.. You'd think that the iPad mini 4 would be capable of both.
So the lesson learned is, create a complete barebone test-app first before posting questions on SO..

Related

Repeated speech in email compose window when using Voiceover

As Voiceover users attempt to dictate in an email compose window, their words are repeated back to them as they speak.
Although this does not happen in Mail, it does occur both in my complex shipped app, and in a very simple test app, which is just a default template with only this code added...
#interface ViewController () <MFMailComposeViewControllerDelegate>
-(void) viewDidAppear:(BOOL)animated {
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setSubject:#"Subject Goes Here."];
[mailViewController setMessageBody:#"Your message goes here." isHTML:NO];
[self presentViewController:mailViewController animated:YES completion:NULL];
}
Has anyone seen this, and knows of a solution, or can confirm that it is an iOS bug? I see almost no similar reports of it around the web.
I do wonder if I am using Voiceover incorrectly, but I don't see a similar problem in Mail. Normal dictation into this window works fine (although I am seeing a stereo waveform displayed instead of the usual mono one at the moment- I'm not sure if that is relevant)
I was able to replicate the behavior, but you have to do some weird things. The only way I was able to get this to happen was by moving accessibility focus away and back into the composer view after enabling dictation. This is a bug and since it's a bug contained in a bit of private API it's a bug you can't really work around. In practice I would suspect that it's a bug that wouldn't show itself very frequently.

Warning: Attempt to dismiss from view controller <ViewController> while a presentation or dismiss is in progress

I´m new to Xcode but I keep on making some small apps to learn. I have run into a problem that only sometimes occurs with the message "Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!" and the app then crash.
I have searched around and found some possible answers but no luck for me yet.
My code for back is:
- (IBAction)Back {
UIViewController *back = [[UIViewController alloc] initWithNibName:nil bundle:nil];
[self presentViewController:back animated:NO completion:NULL];
I understand that the problem is that I try to go from one viewcontroller to another before the presentation of the viewcontroller is done.
The strangest thing is that this sometimes isn´t any problem and the app works flawlessly.
Ok, I think you have trouble with the concept of navigation in iOS. First take a look at iOS Human Interface Guidelines: Navigation, and then read: Navigate with UINavigationController in iOS7 (don't worry about ios 7 or 8, they're both similar)
Overall, I really recommend watching Stanford's Developing iOS 7 apps for iPhone or following the newest one: Developing iOS 8 Apps with Swift to learn!

calling a second view in iPad app

I am trying to adapt an existing application to an iPad app. The application has a main view that calls View2 that is in "View2.xib". Everything has been working well, until I entered the following:
if(!view2Controller)
{
view2Controller = [[View2Controller alloc] initWithWindowNibName:#"View2"];
}
[view2Controller showWindow:self];
This works in my original Cocoa program, but in the iPad application it is currently returning a warning: "Thread1: Program received signal "SIGBRT" While working with it, I've also received a message Method -initWithWindowNibName not found.
Similarly, I have the same problem with the method showWindow.
I wonder how it is that this problem shows up when I try to convert it to an iPad app.
I've run out of ideas to check and would appreciate some assistance.
You will need to change it to the following
if(!view2Controller)
{
view2Controller = [[UIViewController alloc] initWithNibName:#"View2" bundle:nil]
}
//If you are in a view controller use
[self presentModalViewController:view2Controller animated:YES];

MFMessageComposeViewController canSendText class returning YES on Simulator

Issue is pretty much in the title. Implementing the standard code everyone seems to use to send an SMS within an app and it's returning YES on the Simulator. Thought it could be because i'm using the iPhone Simulator but it does the exact same thing on the iPad Simulator. Not sure if sample code is worth posting, but here it goes..
.h
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMessageComposeViewController.h>
.m
-(void)sendSMS {
if([MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
controller.body = #"Hello";
controller.recipients = [NSArray arrayWithObjects:nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
}
It doesn't crash the Simulator, it shows a Modal VC with a standard blue Navigation Bar and just black content.
My main concern is that it will return YES on devices that cannot support it (ie. iPod/iPad). If it's a bug within the Simulator then i'll settle for that. Used this code plenty of times and it's always returned NO when running on the simulator. I havn't got access to an iOS device without SMS capabilities so i can't test it.
Any ideas? Is the problem staring me in the face? Thanks for any help.
This is a bug in the simulator, rest assured, in Xcode 4.3 it just pops up an empty view controller with the following console message:
Application tried to push a nil view controller on target <MFMessageComposeViewController: 0x805eb20>
But with Xcode 4.2, it crashes... not so good...

Popover changes in iOS 5?

I have just developed an iPad app to the point of testing, but did it in iOS 4.3. Now I've updated to 5.0 in the simulator and also went through Apple's steps to test on my iPad which runs 5.0
In the 4.3 simulator all works fine. But in the 5.0 simulator and on the iPad all of my popovers that originate from UIButtons crash the app. I have a popover coming from a navbar button which works fine.
Each popover that crashes will display its contents (a UIWebview with a pdf file), but when I then click anywhere on the screen the app crashes (within the popover and outside).
I can post some code, but hope that this description helps give someone an idea. I don't manually dismiss the popover or check if it is open, but since this doesn't only occur by trying to touch its launching UIButton I don't think that's why it's happening. Plus it works as is under 4.3
Edit: This is solved now thanks to Stephen's comment. I added into the popOver's content viewController:
- (void) dealloc {
[webView release];
[super release];
}
Usually I would call [super dealloc] instead of [super release], but [super dealloc] didn't fix the exception (exc_bad_access). Hopefully I haven't put a sloppy patch on the problem!
I had a thread started to collect bugs like this, but the forum police quashed it. Suffice it to say that iOS 5 is riddled with incompatibilities.
I can't say with any certainty what your problem is, but there's a good chance it has to do with the changes to UINavigationController, which caused UIViewController's navigationController to be nil for popups, with parentViewController taking its place.
Unfortunately, parentViewController is new, so you must, eg, test respondsToSelector:#selector(parentViewController) and take parentViewController if it exists, otherwise navigationController.
Had to add this logic in about 30 places in an app we have.

Resources