I'm tring to send an audio file to other apps.
If I only provide the file url, I can send to AirDrop, mail and message app
NSURL *url = [[NSURL alloc]initFileURLWithPath:file];
NSArray *objectsToShare = @[url];
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
// Present the controller
[self presentViewController:controller animated:YES completion:nil];
If I add the file name to the object to share I can also send it to clipboard
...
NSArray *objectsToShare = @[@"filename.m4a", url];
...
But how can I send it the other application accepting audio file? For example my application accepts "public.audio" and is listed by other apps that send audio files.
For opening a file in another app you should use the UIDocumentInteractionController ; its guide might be helpful too
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.