3

For testing purposes I wrote two apps:

  • First one plays an MP3 file using UIDocumentInteractionController
  • Second one does nothing but registers for the file type "public.mp3"

If I deploy the apps to the iPhone Simulator, my MP3 player app shows a button on top "Open in 'MP3Test'". If I deploy to the iPad Simulator however, there is no button and no "Open In" menu either.

This has been tested with iOS5.

Can somebody explain if this is a bug or a feature and what the reason is behind it?

3 Answers 3

2

Depends upon where you are presenting it from.

If you are presenting it from somewhere around the middle of the screen or below, just present from the frame of the object that you are presenting from.

if that is on the navigation bar, try this:

NSString *fileToOpen = [[NSBundle mainBundle] pathForResource:@"License" ofType:@"pdf"];
UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:fileToOpen]];
controller.delegate = self;

CGRect navRect = self.navigationController.navigationBar.frame;
navRect.size = CGSizeMake(1500.0f, 40.0f);
[controller presentOptionsMenuFromRect:navRect inView:self.view animated:YES];
Sign up to request clarification or add additional context in comments.

1 Comment

I'm not presenting at all. The button that is supposed to show the menu with available apps is shown on iPad but not on iPhone. I register for MP3 (App 1) and USE UIDocumentInteractionController to play an MP3 (App 2). On iPad, App 2 offers me to open the MP3 in App 1. On iPhone, UIDocumentInteractionController is not showing an "Open In" button.
0

The iPad has an affinity for popovers (see UIPopover), why it presents UIActionSheets in them. Facing a similar issue that you had, I had my UIDocumentInteractionController present itself from an UIBarButtonItem (resulting in a UIPopover presentation), rather than from the view itself (something that worked just fine on the iPhone):

  1. Save a reference to the action button (I have mine in my navigation bar).

  2. Use PresentOpenInMenu using the action button reference, rather than the View reference, resulting in a UIPopover-presentation.

Please note that the change does not effect the iPhone app - it behaves likes before, i.e. opens the OpenInMenu from the bottom of the screen just as it would, if you'd used the View reference to present it.

1 Comment

Hm, no. The apps both have a UIToolbar on top. And iOS automatically puts an "open in" in there on the iPhone but not on the iPad. I don't add any buttons myself.
-1

On iPad UIDocumentInteractionController appearing like Pop Up Try something like this

-(void)shareClick:(UIButton*)sender {
   /*some code*/
   CGRect rectFor appearing = [sender.superview convertRect:sender.frame toView:self.view];
   [interactionController presentOptionsMenuFromRect:rect inView:self.view animated:YES];
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.