tags:

views:

64

answers:

2

I am building an app that takes advantage of 4.0 features like in-app messaging but I also want my app to work on all 3.x versions. How do I check if the device can use MFMessageComposeViewController?

A: 

Try this:

#import <MessageUI/MessageUI.h>
#include <dlfcn.h>

if ( dlsym(RTLD_DEFAULT, "MFMailComposeErrorDomain") != NULL ) {
        // MFMessageComposeViewController framework is available
} else {
        // do alternative for no MFMessageComposeViewController
}

Don't forget to weak link the MFMessageUI framework.

hotpaw2
A: 

You could check the device's current operating system using the UIDevice class.

http://developer.apple.com/iphone/library/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html

The systemName and systemVersion properties may be what you're looking for. You'll also need to weak link the framework!

dc