Mfmailcomposeviewcontroller Crashes Because of Global Appearance Properties on iOS6

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



Leave a reply



Submit