Question

we can use UIDocumentInteractionController to share a file to other apps like this:

    NSURL *url = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource: @"test.txt" ofType: nil]];
UIDocumentInteractionController *dic = [[UIDocumentInteractionController interactionControllerWithURL: url] retain];
[dic presentOpenInMenuFromRect: CGRectZero inView: self.view animated: YES];

but how to share a text string(not a text file) by UIDocumentInteractionController? Android Device can do this.

Thanks.

Was it helpful?

Solution

You can't, UIDocumentInteractionController is for documents. It is even in the name.

A solution would be to save the string to text file and share that file, or if you want to share a string, for example to post on a social network you should use UIActivityViewController

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top