Hi,
In my app, I have a logs mechanism, which offer the possibility to the customer to send the logs via mail.For this, I integrated in my app the Apple MFMailComposeViewController. In case that the customer use a device with low OS version (2.x) or an e-mail account isn't presented on the device, I pushed some UIAlertsView with some suggestive messages for users. Can somebody please take a look over my below code, and reply if there is something that could lead to a rejection by Apple?
BOOL canSendmail = [MFMailComposeViewController canSendMail];
if (!canSendmail) {
NSMutableString* osVersion = [NSMutableString stringWithString:[[UIDevice currentDevice] systemVersion]];
EventsLog* logs = [EventsLog getInstance];
if ([osVersion characterAtIndex : 0] == '2' || [osVersion characterAtIndex : 0] == '1' ) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Email", @"")
message:NSLocalizedString(@"Failed to send E-mail.For this service you need to upgrade the iPhone OS to 3.0 version or later", @"")
delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles: nil];
[alert show];
[alert release];
[logs writeEvent : @"Cannot send e-mail - iPhone OS needs upgrade to at least 3.0 version" classSource:@"LogsSessionDetailViewController@sendEmail" details : (@" device OS version is %@",osVersion)];
return;
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Email", @"")
message:NSLocalizedString(@"Failed to send E-mail.Please set an E-mail account and try again", @"")
delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles: nil];
[alert show];
[alert release];
[logs writeEvent : @"Cannot send e-mail "
classSource:@"LogsSessionDetailViewController@sendEmail" details : @"- no e-mail account activated"];
return;
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Email", @"")
message:NSLocalizedString(@"The data you are sending will be used to improve the application. You are free to add any personal comments in this e-mail", @"")
delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", @"") otherButtonTitles: nil];
[alert addButtonWithTitle:NSLocalizedString(@"Submit", @"")];
[alert show];
[alert release];
Many thanks,
Alex.