'Objective C: Send log file with UIActivityController

I'm trying to send a log file from my App. When I try to send it, I only receive a text file with the path to the file. The path is correct, in my code I additionally check for the existence of the file.

NSString *logFile = @"/path/to/file/log.txt";
NSArray *dataToShare = @[logFile];

UIActivityViewController *viewController = [[UIActivityViewController alloc] initWithActivityItems: dataToShare applicationActivities: nil];
if(viewController == nil) return;
dispatch_async(dispatch_get_main_queue(), ^{
    [self presentViewController:viewController animated:YES completion: nil];
});

In the first step, I want to send a single file. Later I want to be able to send the whole folder. I used the same procedure in Swift, which is working great. However I can not make it work in ObjC.

Same subject here, unfortunately without an solution.

How to share a text file with UIActivityViewController



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source