Reputation: 401
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.
Upvotes: 0
Views: 3793
Reputation: 23359
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...
Upvotes: 1