Prevent third-party extensions from appearing in the Open In application list
In my application, I have embedded a custom activity in the Share Sheet called Open In, and clicking on this icon will create a .txt file and present a list of applications that can open and work with this generated .txt file, iOS automatically adds "Open In" before each application name in the general sheet.
But now that third-party developers have implemented sharing extensions, for some reason they appear in this Open In interface as well. For example, Twitter appears, but when I click on it, the text in the .txt file does not appear in the layout window. Therefore, these third-party sharing extensions in this interface are completely useless. Plus, they were already presented in the original shared sheet (and there they work) - the user pressed Open In, so they can only see the applications that can open the .txt file.
How can I ensure that only Open In apps will be offered in this custom action?
//make a txt file to write the data
NSString *fileName = [NSString stringWithFormat:@"%@Text.txt", NSTemporaryDirectory()];
[self.textToShare writeToFile:fileName
atomically:NO
encoding:NSUTF8StringEncoding
error:nil];
NSURL *textFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"Text.txt"]];
self.openInController = [UIDocumentInteractionController interactionControllerWithURL:textFileURL];
self.openInController.delegate = self;
BOOL didPresentOpenIn = [self.openInController presentOpenInMenuFromBarButtonItem:self.buttonToPresentFrom animated:YES];
if (!didPresentOpenIn) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No Apps Available"
message:@"You do not have any apps installed that can open text files."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
source to share
No one has answered this question yet
Check out similar questions: