-(IBAction)showMailPicker:(id)sender { |
// The MFMailComposeViewController class is only available in iPhone OS 3.0 or later. |
// So, we must verify the existence of the above class and provide a workaround for devices running |
// earlier versions of the iPhone OS. |
// We display an email composition interface if MFMailComposeViewController exists and the device |
// can send emails. Display feedback message, otherwise. |
Class mailClass = (NSClassFromString(@"MFMailComposeViewController")); |
|
if (mailClass != nil) { |
//[self displayMailComposerSheet]; |
// We must always check whether the current device is configured for sending emails |
if ([mailClass canSendMail]) { |
[self displayMailComposerSheet]; |
} |
else { |
feedbackMsg.hidden = NO; |
feedbackMsg.text = @"Device not configured to send mail."; |
} |
} |
else { |
feedbackMsg.hidden = NO; |
feedbackMsg.text = @"Device not configured to send mail."; |
} |
} |
|
Verify the existence of the above class
最新推荐文章于 2020-12-21 01:53:44 发布