MFMailComposeViewController Crashes because of Global Appearance Properties on iOS6
Try using UITextAttributeTextColor
instead of NSForegroundColorAttributeName
.
MFMessageComposeViewController crashes in iOS 6
The probable reason is that your picker is nil
. The code will work only on devices that can send text. In regards to the same, you should always check for message sending capability using [MFMessageComposeViewController canSendText]
and only then show the picker. From Apple's MFMessageComposeViewController documentation:
Before presenting a message composition view, call the canSendText class method to ensure that the user’s device is appropriately configured. Do not attempt to present a message composition view if the canSendText method returns NO. If SMS delivery isn’t available, you can notify the user or simply disable the SMS features in your application.
Starting in iOS 5, you can register to be notified of changes to the availability of text message sending by way of the MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification notification.
EDIT:
Using UITextAttributeTextColor
instead of NSForegroundColorAttributeName
wherever you're setting NSForegroundColorAttributeName
using probably the UIAppearance
methods in your app should fix the error.
AdBannerView crashes app when it is clicked
This issue seems to be caused by a global appearance setting.
There is a similar error cause by this setting as pointed out in this question:
Use UITextAttributeTextColor
instead of NSForegroundColorAttributeName
.
Why calling MFMailComposeViewController deallocates the view that called it?
I would assume it's because you're releasing the composer before it finishes.
[composer release];
EDIT: How is this property initialized and why is it a property? Create it in the method and try. Also, your unbalanced calls are happening because you're animating a UIAlert at the same time you are animating the mail controller dismiss. Each needs to finish prior to prevent that message.
composer = [[MFMailComposeViewController alloc] init];
Try to remove the property and initialize in the function.
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
Make sure you added the delegate properly as well.
#import <MessageUI/MessageUI.h>
@interface YourViewController : UIViewController <MFMailComposeViewControllerDelegate>
Set your delegate like this
composer.mailComposeDelegate = self;
For the unbalanced calls, rearrange your alert like this...
[self dismissViewControllerAnimated:YES completion:NULL];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error"
message:[NSString stringWithFormat:@"error %@", [error description]]
delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil];
[alert show];
EDIT 2:
After seeing your comment about not being able to use ARC due to one class I would advice you to simply set a -fno-objc-arc compiler flag on that class and enable ARC across your project and make your life WAY easier.
Disable Automatic Reference Counting for Some Files
Related Topics
What Do the "M" and "A" Icons in the Project Navigator of Xcode 4 Mean When I Create a New Project
Accessing Variables from Another Viewcontroller in Swift
Enable/Disable Apple Push Notification from iPhone App
Avspeechsynthesizer in Background Mode
How to Properly Group a List Fetched from Coredata by Date
Why Would a 'Scheduledtimer' Fire Properly When Setup Outside a Block, But Not Within a Block
Search Bar and Search Display Controller in Table View
iOS Swift: How to Change the Font Style of a Certain Word in a String
Error in Xcode 6 - View Controller Does Not Have an Outlet Named (Subview)
Set Text Color and Font for Uidatepicker in iOS8/Swift
How to Send Data from iPhone to Apple Watch in Os2 in Objective-C
Swift 3: Unrecognized Selector Sent to Instance Xcode 8
Setting Multiple Times for Notifications in Swift
Proper Usage of the Alamofire's Urlrequestconvertible
Uiview with Shadow, Rounded Corners and Custom Drawrect