Can i save photos to the camera roll without user explicit consent? - iphone

i'm developing an iPhone application that let users to take photos. Those photos are saved inside the application, but i would like also to save them to the camera roll.
The problem is that my application does not have a UI control that let the user specify if he wants the photo to be saved also in the camera roll.
I searched the Apple guidelines and documentation but could not find any hint regarding this issue.
So in your experience is ok to save photos taken by the user also in the camera roll without asking his permission?

It is perfectly fine to write to camera roll without permission..but it is better to show a successful save alert once you save photo.. user won't be happy if you are saving unnecessary/involuntary photo without some feedback to user
void UIImageWriteToSavedPhotosAlbum (
UIImage *image,
id completionTarget,
SEL completionSelector,
void *contextInfo
);
above is the method to save the image .. it can be find in apple docs here Save to camera roll

If the user is taking the photo himself by tapping a button or whatever, saving to the camera roll is the best you could do, IMO, and I don't think you need to show an alert or whichever kind of notice.
The only thing, make sure the user knows where he should go to retrieve his pictures...

Related

iOS 6 in app camera

Im building an app that allows the user to record a video (in app) by pressing a button on the main screen. I don't want the user to be taken to the photo app because the video will only be able to be viewed on the app (Max of 15 seconds) and I can't quite get it. Anyone have the code to do this? A good example of what i want the camera to do is the camera in the app Cinemagram. Thanks for any help.
If you plan on saving the movie to the user's photo library, then you can use UIImagePickerController. In particular, you should read the guide that accompanies the class.
However, if you only want the video to be temporary, then you will probably want to use AVFoundation. You would then need to configure an AVCaptureSession with an AVCaptureMovieFileOutput to write the video to disk. Then, when you are ready to play the video, create an AVURLAsset with the file url that you just wrote, use that to create an AVPlayer to play the video, and add an AVPlayerLayer to your view, with said player, to display the video.
Either way, I would recommend studying the examples that Apple provides.
AVCam and
AVPlayerDemo should be more than enough to get you started (especially the AVCam example project).

Can we know how many albums there are in the iphone's camera library?

I have a small question. We want the user to the able to choose an image from his device's library. If he has more albums apart from the camera roll, we use UIImagePickerControllerSourceTypePhotoLibrary, so he could browse all the albums. The problem comes when he only has the camera roll. In that case we want him to go directly to the camera roll screen, instead of showing an albums table with the camera roll as only choice. It is an useful step.
The question: Is there way to know that there is only one album (camera roll) in the device, so we use UIImagePickerControllerSourceTypeSavedPhotosAlbum and skip that intermediate case?
Is there any other solution?
Thanks a lot.
You can use the ALAssetsLibrary method enumerateGroupsWithTypes:usingBlock:failureBlock: to iterate over all albums in the photo library. It doesn't give you the count directly so you would have to increment your own counter but it should give you the desired result.
Check the documentation for enumerateGroupsWithTypes:usingBlock:failureBlock: for more info on the method.

Save a UIImage to a different name

I am writing an application which lets the user pick one photograph from a selection. Then I want to save that photograph to their photo roll to a specific name. i.e I always want the photo in the roll to be named the same thing and overwrite previous selections.
UIImage* image = [UIImage imageNamed:[ImageNames objectAtIndex:self.miImage]];
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
I can't find anyway to make a copy of the image and assign a new name to it, or specify a target name for UIImageWriteToSavedPhotosAlbum().
Is there any way to do this?
thanks in advance,
Jay
You cannot specify a filename when using UIImageWriteToSavedPhotosAlbum because it saves the image to the Camera Roll (or the Photos Library, if the device does not have a camera). This allows the system to assign it a name based on a format, like "DSC0001.jpg" or similar, and avoid name collisions.
Because of this, overwriting an image is also not possible, since the Photo Library / Camera Roll are controlled by the user - a user that would not appreciate a photo being overwritten by your application.
...writing the image to the user’s Camera Roll or Saved Photos album.
UIImageWriteToSavedPhotosAlbum Reference

Is there any standard fileopen dialog in iphone programming?

I want to create application, that will process images(mostly - photographs from mobile camera).
So i need at first to provide the way to open image file from phone memory.
how can i do that?
Sorry for such a stupid question, but i am newbie in iphone programming(yet:)).
P.S. I use xcode, cocoa
You can use UIImagePickerController to get a standard interface for selecting a photo from the user's library or camera roll. Depending on the configuration, it can also be used to capture a new image with the camera. Note however that you get a UIImage back, not a file, if you want to upload it somewhere, you will first have to create a file or NSData object from the image, using either UIImagePNGRepresentation() or UIImageJPEGRepresentation().

Is there a way to get paths of all the images of CAmera roll

Is there any way to create an array or something
having paths of all the images stored in camera roll.
Please enlighten me on this.
Thnx in advance
SpyPhone uses a direct path to the users photo library:
http://github.com/nst/spyphone/
It seems that any application can read it. However, this seems like falls under the area of "undocumented API" and could well be rejected in a real application.
I don't think there is. As far as the API is concerned for the UIImagePickerController you can only get a single path for a Movie that was recorded by the user (if running 3.0 on a 3GS). And even that path is a file URL to the temporary folder where the movie is stored before being written to the library.
You can't get paths for any images in the photo library or the camera roll.
When you pick an image using the UIImagePickerController the controller returns the Original Image and an "Edited Image" if the image was edited before being chosen.