0

I have a doubt, is it possible to enable the "Open in" only for a particular condition? Let me explain... I am creating an application that will allow only some users to open in my application some files.

For a particular user, I want that tapping an item in mail app will be shown the popover "Open in MyApplication".

For the other ones, i don't want to show the pop up.

Is it possible?

I know that i can manage the situation directly on the application when retrieving the URL of the request, but i'd like to have the behaviour described above.

Corey1986
  • 73
  • 1
  • 6

2 Answers2

2

You could always just prevent the opened file from being displayed in your app through:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {    
     if (url != nil && [url isFileURL]) {
          if([self wantedUser])
               [self openURL:url];
          else
               return FALSE;
     }    

     return YES;
}
keji
  • 5,947
  • 3
  • 31
  • 47
1

No, this is not possible. Your app either declares that it can handle files of a certain type or it doesn't. The standard "Open In" menu is based on what your app declares in the Info.plist. There is no way to make this conditional.

rmaddy
  • 314,917
  • 42
  • 532
  • 579