Reputation: 475
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.
Upvotes: 3
Views: 2129
Reputation: 69499
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
Upvotes: 4