回答

2

實現您的委託以下方法:

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { 
id tracker = [[GAI sharedInstance] defaultTracker]; 
switch (result) { 
    case MFMailComposeResultCancelled: 
     [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action"                action:@"event_action" // Event action (required) 
      label:@"Cancelled"   // Event label 
      value:nil] build]]; // Event value 
      break; 
    case MFMailComposeResultSaved: 
     [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action"                action:@"event_action" // Event action (required) 
      label:@"Saved"   // Event label 
      value:nil] build]]; // Event value 
      break; 
    case MFMailComposeResultSent: 
     [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action"                action:@"event_action" // Event action (required) 
      label:@"Sent"   // Event label 
      value:nil] build]]; // Event value 
      break; 
    case MFMailComposeResultFailed: 
     [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action"                action:@"event_action" // Event action (required) 
      label:@"Failed"   // Event label 
      value:nil] build]]; // Event value 
      break; 
    default: 
      break; 
} 
} 
相關問題