I am trying to use a UIActivityViewController
to share an audio file (.aac). It is a temporary file that I have written to the sandboxed documents directory.
I pass a NSURL
in the initWithActivityItem:
method.
[audioData writeToFile:[urlToAudioFile path] options:NSDataWritingFileProtectionNone error:&error];
UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:@[urlToAudioFile] applicationActivities:nil];
[self.view.window.rootViewController presentViewController:activity animated:YES completion:^{
...
}];
When I press the share button it takes a few seconds and the activity sheet pops up with the only option being Airdrop.
How can I get other options like email or iMessage to show up? Is there a call back method so that I can determine when the "sharing" is finished, so that I can delete the temporary file again?
Is there a way for me to add the audio file without having to write it to disk first? Can't I somehow just pass the NSData
object?