Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a photo to my app from default iOS Camera app?

I know my app can read the photos saved in iOS photo-library; also my app can save a new photo in the default iOS photo-library. But what I am trying to achieve is something like this: the default Photos app should be able to send a photo to my iOS app, just like you can share a photo to Facebook or send to iOS Mail app.

enter image description here

I want my application to be listed in this screen. Note: this is a screenshot of iOS6 Photo application.

like image 747
Prabu Arumugam Avatar asked Feb 14 '13 14:02

Prabu Arumugam


1 Answers

POSSIBLE!!!

This thing is very interesting on iOS.

You have to tell iOS what kind of files your app can open (see pic below)

enter image description here

  • Kind of file your app can open will be set by Conforms To field (see all kinds https://developer.apple.com/library/ios/documentation/miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html)

  • This is a best sample about it (http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app)

You have to implement -application:handleOpenURL: in AppDelegate

-(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url {
      //url is a local url of photo you've chosen, iOS copied it into document folder of your app
      //do what you want
}

================================================

If you want to see how some app (Dropbox, GoogleDrive ...) can open some kind of files, you can see their info.plist files

Good luck

like image 77
Tony Avatar answered Sep 18 '22 16:09

Tony