IOS Sharing CSV files with UIActivityViewController

I have an app that I share CSV files with, I share other files that work great with both built-in options (like Mail) and external options like the Gmail or Evernote app.

If I try to use a CSV file, the Internal Mail option works as expected, however other options such as Gmail or Evernote only transmit text. If I rename my CSV file to "pdf" it also works in everything.

Is there a whitelist of allowed file types that can be split?

My code is simple and looks like this:

NSArray* activityItems = [NSArray arrayWithObjects: customItemAttachment, customItemText, nil];
...
UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil ];

      

share:

    NSString* fileName = [[BDData sharedData] addDateToFileName:@"DataLog%@.csv"];
    NSData* data = [s dataUsingEncoding:NSUTF8StringEncoding];
    NSString *fileNameLong = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName];
    [data writeToFile:fileNameLong atomically:YES];
    MyShareData* shareData = [MyShareData shareData];

      

If I rename DataLog.csv to DataLog.pdf everything "works", it's just a wrong extension.

+3


source to share





All Articles