Creating an app that accesses all images in user's Photos for iOS? - iphone

I haven't found any documentation on this or seen this done before, but is there anyway I can, instead of just choosing one image with UIImagePicker, load the user's albums, and then after selecting an image, that image displays, but also allows me to scroll left and ride to see all the images before and after that image?
I know I can use a multiple image picker, but that involves importing all the user's photos, and if the user has hundreds of photos, this would take a lot of time. I'm looking for similar functionality to the real photos app- the performance and everything. Any ideas?

Yes, you can. Look at the documentation for ALAssetsLibrary. This will allow you to enumerate all the user's image (and video) libraries. From this, you get ALAssets, which you can ask for their default ALAssetRepresentation. This one, in turn, you ask for its CGImage, from which you can create a UIImage.
Enumerating Libraries and Assets is done in blocks, which can easily be done in the background.

Use the assets library: http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html
An instance of ALAssetsLibrary provides access to the videos and
photos that are under the control of the Photos application.
The library includes those that are in the Saved Photos album, those
coming from iTunes, and those that were directly imported into the
device. You use it to retrieve the list of all asset groups and to
save images and videos into the Saved Photos album.
note: only available in ios 4+

Related

save profile image inside app using the built in camera

I have an app that contains a profile of the user.
In the profile editing, he has an option to take a photo of himself, then that photo should be saved in his details and be presented in certain places in the app.
Is there a way to internally save an image (not in his phone's photo gallery, but inside the app itself, so he cannot delete the photo through the phone), and then fetch that image every time I need it?
I understand I cannot use CoreData to save images, so I am wondering if there is an easier way to get it done efficiently.
Or must I do that in a server?
not in his phone's photo gallery, but inside the app itself
You can't store anything at runtime "inside the app itself". But the app has a sandbox, a folder area belonging to you alone, where you can store any file you like — in the Documents folder or the Application Support folder, for example. So why not just use that?

iPhone is there a way to analyze timestamps of all photos on the camera roll?

I have ~3200 photos on my iPhone over 2 years and would like to create an app that analyzes and plots when I took these pictures (ex: I was very actively photographing for a week, and then stopped). Is there a way to do bulk processing of camera roll photos on iPhone(with user permission) to extract timestamps of photos?
I think if I back up my photos to my mac with the "image capture" app, I can do this kind of metric analysis with a Mac app, but the import process would take hours and I'm looking for something simpler.
Take a look at ALAssetsLibrary
An instance of ALAssetsLibrary provides access to the videos and
photos that are under the control of the Photos application.
Here is sample application PhotosByLocationn.
Demonstrates how to use the AssetsLibrary APIs to provide a custom
image picking UI. The user experience is centered around the idea of
using the assets location and time metadata as a basis for certain
features.
Yes you can use the Assets Library for this.
This fill allow you acces to the image on the users device.

Deleting photos from phone using UIImagePickerController

The documentation indicates : pick a photo from library or camera roll and delete with user permission.
Is that possible using UIImagePickerController? Or does a user have to explicitly delete the selected photo?
This isn't possible regardless of what you use to try to accomplish it. The UIImagePickerController is only for choosing photos and does not modify them in any way. A more promising way, would be with the Assets Library but, even with this framework, you are unable to delete a users photos. That being said, if you want to use this functionality in your app, it will have to be for jailbroken devices only.
In short, the user has to navigate to the photos app and delete the images themselves.
Thanks to the iOS 8 Photos Framework, you can now delete images from the user library! I recommend you check out Apple's example app using the Photos Framework for a more detailed example of how to use it, but the relevant bit is:
//under SamplePhotosApp/AAPLAssetViewController.m
// Delete asset from library
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
[PHAssetChangeRequest deleteAssets:#[self.asset]];
} completionHandler:completionHandler];
where self.asset is a PHAsset object (which can be acquired in several ways) referring to the photo you wish to delete. Oh, and don't forget to import the Photos framework!
Hope this helps!

How to save a large (60mb+) image to photo library?

I know the various ways to save a UIImage to the photo library:
UIImageWriteToSavedPhotosAlbum
ALAssetsLibrary
However, my images are HUGE (60mb+), so bringing them into memory is not possible. I can download the images by streaming them to disk, and even use imageWithContentsOfFile to take a peek (although that is kind of unnecessary given screen size).
But I want the user to be able to save these images for later. Is there anyway for me to get these large images into the photo library? Do I just have to keep them stored locally inside the app sandbox?
I believe that there is no point at storing them at the photo library, since it is designed to be viewed on the device and theres no point at viewing an image so big. If you want to let the user see the image then i suggest you create a preview and save THAT version into the photo library. If you want to let the user transfer them from the device to the computer there is a special folder in your app bundle which will allow those pictures to appear when using itunes and selecting your application. then he can transfer those pictures to his computer. Also could you elaborate on the characteristics of the images? format, dimentions, purpose, etc.

Using a UIImagePicker that only contains photos taken within the app

I'm using source code from apple (SquareCam) and I would like to figure out how I can use the photos taken in that app and see them in a library (like the photos app) without having all the other photos the user has taken elsewhere like in the regular camera.
I'm not too great at making apps yet so I'm pretty noobish.
I've gotten as far as opening the photo library but nothing else. no viewing individual photos or the options such as emailing, messaging and what not.
Don't think you can do that. It either all photos or no photos...
You can of course save the photo in your own documents directory and write your own photo viewer - there's quite some code and frameworks around that do most of the job, see e.g. the answers to this so question:
Open source photo viewer for IPhone