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
2010-09-01 23:29:35
A:
You could check the device's current operating system using the UIDevice
class.
The systemName
and systemVersion
properties may be what you're looking for. You'll also need to weak link the framework!
dc
2010-09-01 23:30:02