0

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

ChuckT
  • 1
  • 2
  • You just create an array with the name to Your logfile. If You want to send the content of the file you have to init an NSString with contentsOfFile. This might help You: https://stackoverflow.com/questions/24097826/read-and-write-a-string-from-text-file – ivion Apr 24 '22 at 13:19

0 Answers0