Checking That Mail Is Configured and the Internet Is Available
Listing 4.6 shows the code that performs both checks. You can replace the direct call to displayComposerSheet
in tapButton
with this code, which incorporates the necessary checks before it either calls displayComposerSheet
or posts an alert. This code is based on the MessageComposer sample app.
- (IBAction)tapButton:(id)sender { //1 NSLog (@" %@", _userTextView.text); Class mailClass = (NSClassFromString(@"MFMailComposeViewController")); if (mailClass != nil) //2 { // We must always check whether the ...
Get Learning iCloud Data Management: A Hands-On Guide to Structuring Data for iOS and OS X now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.