Trying to achieve the same functionality as an Excel page that is shared or a Word doc that is shared opens the Excel or Word app.
I have a document with a custom extension .DLMSFT and .dlmsft. They are both registered in my app's Document type, Exported Type Identifiers and Imported Type Identifiers
See plist below:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Routes</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Routes</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Routes</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>com.Routes</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>dlmsft</string>
<string>DLMSFT</string>
</array>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Routes</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>com.Routes</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>dlmsft</string>
<string>DLMSFT</string>
</array>
</dict>
</dict>
</array>
Expected Output - To share via iOS Share Sheet to something like Teams or Slack or Outlook and when the receiving user opens the file it will open the app automatically IF they have it installed.
Current Output - I am able to share the file to all available apps including mail and outlook however when I share to MS Teams and the user on the receiving end opens it the app is not launched and instead they get an error that says "Teams cannot open the file as its unsupported". The same happens in Outlook. iOS Mail app is the only one that even allows you to choose the app to open the file.
For more context below is the code for sharing the document using the Share Sheet:
public static async void ShareRoute(Route route)
{
var routeTitle = $"{route.Start.Name}-To-{route.Destination.Name}.DLMSFT";
var fn = routeTitle;
var file = Path.Combine(FileSystem.CacheDirectory, fn);
File.WriteAllText(file, SerializeRoute(route));
await Share.RequestAsync(new ShareFileRequest
{
Title = routeTitle,
File = new ShareFile(file)
});
}
I feel like I have read docs after docs after docs and I also think I am following all the correct steps. Not sure what I am missing. Hopefully someone can lend a helping hand. Thanks all!