I'm having a problem when using the UIActivityViewController to share spreadsheets and videos (and probably other file types). The problem is that the right type identifiers are not found. For example, when I try to attach a spreadsheet, as seen in the code below:
let testFilePath = NSBundle.mainBundle().pathForResource("test_spreadsheet", ofType: "xlsx")
let testData = NSData(contentsOfFile: testFilePath)
let list = [testData]
let activityViewController = UIActivityViewController(activityItems: list, applicationActivities: nil)
navigationController.presentViewController(activityViewController, animated: true, completion: nil)
I get the following log message:
2014-08-20 16:45:58.035 TestExtensionPoints[12608:194174] Discovered extensions: {(
<NSExtension: 0x7fb7fca13680> {id = com.asperasoft.faspex-app.FaspexExtension}
)} for attributes: {
NSExtensionActivationRule = {
extensionItems = (
{
attachments = (
{
registeredTypeIdentifiers = (
"public.data"
);
}
);
}
);
};
NSExtensionPointName = (
"com.apple.share-services",
"com.apple.ui-services",
"com.apple.services"
);
}
Note that the registered type identifier is public.data, instead of public.spreadsheet.
This differs from when I try to attach, say, a pdf or a png file. If I just change the file to a pdf, as seen in the code below (only the first line changes):
let testFilePath = NSBundle.mainBundle().pathForResource("test_pdf", ofType: "pdf")
I get the following log message, which indeed DOES have the desired type identifier:
2014-08-20 16:50:52.973 TestExtensionPoints[12652:196132] Discovered extensions: {(
<NSExtension: 0x7ff2534285a0> {id = com.asperasoft.faspex-app.FaspexExtension}
)} for attributes: {
NSExtensionActivationRule = {
extensionItems = (
{
attachments = (
{
registeredTypeIdentifiers = (
"com.adobe.pdf"
);
}
);
}
);
};
NSExtensionPointName = (
"com.apple.share-services",
"com.apple.ui-services",
"com.apple.services"
);
}
Does anyone know why this is happening, and does anyone have a workaround? I know I can just write the files and attach URLs, but that's not really the purpose of this exercise.
Extra Background: I'm mainly asking this because I'm making a share extension, and am experimenting with how the data will be passed to me. I have already covered the case where it is passed as a URL and as a UIImage. These other cases would be fine, except for the fact that I am not getting the type identifiers I need.