Deleting photos from phone using UIImagePickerController - iphone

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!

Related

Swift image and video asset add to Fusuma

I am using Fusuma for a image video application. I need all the assets(images and videos)of the camera roll. Here PHAsset is using for picking the assets. Here only gallery image is displaying. But I want to show all the images and videos in library section. Can any one please suggest me how can I modify the code for this?
There are 3 source types for apple to retrieve the photos from:
UIImagePickerControllerSourceType.PhotoLibrary
UIImagePickerControllerSourceType.Camera
UIImagePickerControllerSourceType.SavedPhotosAlbum
You can read more about them here: documentation
The PhotoLibrary is what you need to be accessing. If the API gives an option to access one of the two, choose it. If it doesn't, I would try to fork the repo with permission and make the change yourself. The user must give permissions to access the Library folder for you to access it, so be aware of 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.

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

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+

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

Update/Delete Photo using iOS ALAssetsLibrary?

My iPhone App needs to be able to update and delete Photos and Videos on the phone. After seeing the new ALAssetLibrary class I was pretty excited, but now that I'm knee deep in it I'm starting to realize that perhaps Photos and Videos can not be manipulated in the ways I expect.
Just to confirm, is there really no way to update or delete Photos and Videos on iOS, or am I just using the wrong APIs?
I was able to have complete control over Contacts even back before iOS4, and I noticed there's a new API for accessing Calendars now too. Will I be able to update and delete Calendars like I can with Contacts, or should I expect it to give me a hard time like Photos are?
Thanks
There is no way to manipulate existing photos or videos using ALAssetsLibrary, the only thing you can do is save a new photo/video to the Camera Roll.