2

The iPhoto app for the iPhone has a feature (it is part of the Share options) that lets you send one or more photos the the iMovie iPhone application.

Does anyone know how such a feature (send photos to the iMovie app from another app) can be implemented? It seems to be using URL Schemas but I can't find any documentation about it.

Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
LeoRodri
  • 21
  • 1
  • Have you seen any apps that actually do this, or do you just have to save the photos to the camera roll and open them with iMovie? – Mick MacCallum Mar 26 '13 at 13:17
  • I think most of this is answered in http://stackoverflow.com/questions/12546574/using-apple-icons-with-ios-6 -- the question is just, if iMovie actually will register for your movie resource. Can't try that now, because I haven't got my Mac with me. – Arne Mar 26 '13 at 14:20

2 Answers2

0

First, you need the NSURL of the image you want to share. If you're image is just in memory, you can save the image somewhere and then use that URL.

NSURL *imageURL = /* URL of your image */

Now create an UIDocumentInteractionController with the method:

UIDocumentInteractionController *documentInteractionController = 
     [UIDocumentInteractionController interactionControllerWithURL:imageURL];

That's it. You can go ahead and present your documentInteractionController with any of these methods:

– presentOptionsMenuFromRect:inView:animated:
– presentOptionsMenuFromBarButtonItem:animated:
– presentOpenInMenuFromRect:inView:animated:
– presentOpenInMenuFromBarButtonItem:animated:
– dismissMenuAnimated:

So now a popover will show up, listing all the apps that are willing to use your image (including iMovie if installed).

If you want to find out more about UIDocumentInteractionController, go here: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDocumentInteractionController_class/Reference/Reference.html

  • The thing is that when i do that with an image most of the image related applications are suggested, but not iMovie. That is why I was asking if there is any specific trick for reaching iMovie. As I mentioned, iPhoto seems to do it, but may be it is an internal Apple trick. – LeoRodri Apr 02 '13 at 13:28
  • If iMovie only shows up in iPhoto, then Apple is obviously using some private API to do this so as to get more people to buy iPhoto. – Saurav Sachidanand Apr 04 '13 at 11:29
0

use UIDocumentInteractionController :

Right from the doc:

To prompt the user only to open the file in another app, call the presentOpenInMenuFromRect:inView:animated: or presentOpenInMenuFromBarButtonItem:animated: method.

or

To prompt the user with a set of options, including an option to open the file in another app, call the presentOptionsMenuFromRect:inView:animated: or presentOptionsMenuFromBarButtonItem:animated: method.

Here is how you can do it:

  1. Register your first app to be able to handle your preferred image file type
  2. At your second app, implement the methods I stated about from UIDocumentInteractionController. So it will prompt an option for the user to send pic to the first app. Doc for this.
  3. At your first app, implement this method:

    -(BOOL)application:openURL:sourceApplication:annotation:

    to open the picture that is transferred from the first app. The pictures will be stored at Documents/Inbox. Then, you can now happily use the picture in your first app.

Thanakron Tandavas
  • 5,615
  • 5
  • 28
  • 41