Dans mon application, j'ai un mécanisme de logs, qui offre la possibilité au client d'envoyer les logs par mail. Pour cela, j'ai intégré dans mon application le Apple MFMailComposeViewController. Dans le cas où le client utilise un appareil avec une version basse OS (2.x) ou un compte e-mail n'est pas présenté sur l'appareil, j'ai poussé certains UIAlertsView avec des messages suggestifs pour les utilisateurs. Quelqu'un peut-il jeter un oeil sur mon code ci-dessous, et répondre s'il y a quelque chose qui pourrait conduire à un rejet par Apple?Utilisation de MFMailComposeViewController et processus d'approbation 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:@"[email protected]" 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:@"[email protected]" 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];
Un grand merci,
Alex.
Merci, Vladimir.Je ne pensais pas à celui-ci - en effet ce serait crash :). –