Support for Issues

If you are facing any issue in the Applozic iOS SDK then you should contact us and share as much information as you can. One of the most important in that is logs. We will describe in this article how easy it is to share the logs and the other information.

There are a couple of steps that you need to follow to send us the logs. First is we suggest you respond to the shake gesture to send us the logs. Or you can also add a button in your app on click of that you can add below code which will open up the email client.

This should be added in your app's root view controller.

#import <Applozic/ALLogger.h>


- (BOOL)canBecomeFirstResponder {
    return YES;
}



- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
    if ([MFMailComposeViewController canSendMail])
    {

        [ALLogger saveLogArray];
      
        NSDictionary *infoDictionary = [[NSBundle bundleForClass: [ALLogger class]] infoDictionary];
        NSString *applozicVersion = [infoDictionary valueForKey:@"CFBundleShortVersionString"];

        MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
        mailer.mailComposeDelegate = self;
        
        [mailer setSubject:@"Applozic Logs File"];
        NSArray *toRecipients = [NSArray arrayWithObjects:@"[email protected]", nil];
        [mailer setToRecipients:toRecipients];

        NSString *filePath = [ALLogger logArrayFilepath];
        NSData *noteData = [NSData dataWithContentsOfFile:filePath];
        NSString *body = [NSString stringWithFormat:@"Hey there sending you the logs. \n Applozic SDK version no.: %@", applozicVersion];
        [mailer setMessageBody:body
                        isHTML:YES];
        [mailer setMailComposeDelegate:self];
        [mailer addAttachmentData:noteData mimeType:@"text/plain" fileName:@"ApplozicLogs.txt"];

        [UIApplication.sharedApplication.keyWindow.rootViewController.presentedViewController presentViewController:mailer animated:YES completion:nil];
    }
    else
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure"
                                                        message:@"Your device doesn't support the composer sheet"
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];
    }
}

This will open up the email client where the logs file will be attached. You can also CC it to yourself.
In the body please write steps to reproduce the issue and any other details like your application key and the user id with which you are trying.

👍

Also, if there's any other ticket which is open you can mention the ticket number of the same.

📘

Note

Above code will only work in a real device and not in a simulator.


Did this page help you?