Ладно, так разобрался с уродливым безобразным хаком, но, похоже, сработало ... хотелось бы найти лучший способ.
Создать файл заголовка для расширения:
// UIDocumentInteractionController+willShowOpenIn.h
#import <Foundation/Foundation.h>
@interface UIDocumentInteractionController (willShowOpenIn)
- (BOOL)willShowOpenIn;
+ (BOOL)willShowOpenInForURL:(NSURL *)filePathURL;
@end
И реализовать:
// UIDocumentInteractionController+willShowOpenIn.m
#import "UIDocumentInteractionController+willShowOpenIn.h"
@implementation UIDocumentInteractionController (willShowOpenIn)
- (BOOL)willShowOpenIn
{
id <UIDocumentInteractionControllerDelegate> oldDelegate = self.delegate;
self.delegate = nil;
UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
if([self presentOpenInMenuFromRect:window.bounds inView:window
animated:NO])
{
[self dismissMenuAnimated:NO];
self.delegate = oldDelegate;
return YES;
}
else {
self.delegate = oldDelegate;
return NO;
}
}
+ (BOOL)willShowOpenInForURL:(NSURL *)filePathURL
{
UIDocumentInteractionController *tempController = [UIDocumentInteractionController interactionControllerWithURL:filePathURL];
return [tempController willShowOpenIn];
}
@end
Тогда используйте:
#import "UIDocumentInteractionController+willShowOpenIn.h"
...
NSURL *testURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"txt"]];
NSLog(@"Will show - %@",[UIDocumentInteractionController willShowOpenInForURL:testURL] ? @"YES" : @"NO");
Скажите, пожалуйста, есть лучший способ:)