my app make a simple file called log.txt
the URL of this file (viewed in xcode) is file://localhost/var/mobile/Applications/NUMBER OF THE APPLICATION/Documents/log.txt
So I can see this file in the finder ...
I wanted to add the "open in" feature to my app to provide the user to share this file (via mail or imessage) or open this file in another compatible app.
Here is what I do :
-(void) openDocumentIn {
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:docFile]; //docFile is the path
//NSLog(@"%@",fileURL); // -> shows the URL in the xcode log window
UIDocumentInteractionController *documentController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
documentController.delegate = self;
documentController.UTI = @"public.text";
[documentController presentOpenInMenuFromRect:CGRectZero
inView:self.view
animated:YES];
}
Then the call to this function :
-(IBAction)share:(id)sender {
[self openDocumentIn];
}
When I run the app, I click on this "share" button, but nothing appends except showing me the path of the URL in the log window ...
I missed something ...
Thanks
EDIT : finally, it works on my real iphone ... there was no text viewer in the simulator !!! --'
EDIT 2 : it shows the apps that are available (pages, bump ...) but crashes finally :((( ! see here for the crash picture