Must I save the captured image to the Camera Roll when using UIImagePickerController with source type camera? - iphone

From the docs of UIImagePickerController:
When the user taps a button to pick a newly-captured or saved image or
movie, or cancels the operation, dismiss the image picker using your
delegate object. For newly-captured media, your delegate can then save
it to the Camera Roll on the device. For previously-saved media, your
delegate can then use the image data according to the purpose of your
app.
So this reads like I MUST save the captured image to the Camera Roll. Is this true? Reason for rejection if not done?

No, you do not need to save to Camera roll when UIImagePickerController is dismissed. I have done this in several apps.

Related

How to use UIImagePickerController properly on the iPad?

From the documentation of UIImagePickerController:
On iPad, present the user interface using a popover. Doing so is valid
only if the sourceType property of the image picker controller is set
to UIImagePickerControllerSourceTypeCamera.
So what they say is:
On iPad I MUST use a UIPopoverController to display the image picker.
But at the same time, it is limited to UIImagePickerControllerSourceTypeCamera
How about the other source types such as UIImagePickerControllerSourceTypePhotoLibrary or UIImagePickerControllerSourceTypeSavedPhotosAlbum?
In my case I want the user to choose from his photo library and not take a picture with the camera.
Is there a way to use UIImagePickerController to pick photos from a library on the iPad?
I suspect that documention has a typo in it. I've successfully used UIImagePickerController with other sourceTypes on iPad - just had to make sure it was in a UIPopoverController.

UIImagePickerController AVAudioPlayer

When I open a UIImagePickerController, I can display the device's camera input stream.
But when I play an AVAudioPlayer with [player play] then the camera stops working.
How can I deal with that?
you can't because UIIMagePickerController is controlling the audio, you will need to use low level AVFoundation in order to do that.
checkout AVCam sample code how to record a movie and add the view as subview , that way you will stay in control of the audio and will be able to play audio.

UIImagePickerControllerSourceTypeCamera crashes in IPHONE Simulator?

Is it a known issue that if you try to test your UIImagePickerController using the Camera as a source type then the simulator will crash?
I have the following code:
self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.allowsEditing = NO;
self.imgPicker.delegate = self;
[self.imgPicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentModalViewController:self.imgPicker animated:YES];
[imgPicker release];
Running this in simulator, I get an objc-exception-throw error on the stack # -[UIImagePickerController setSourceType:].
Now if I set the source type to the Photo Library though, everything runs smoothly and fine? What's the deal?
Simulator doesn't have the camera and can't simulate to take a picture (it would have been nice to use the isight but Apple has not been so kindly). However Your code is not safe because, for example, old ipod touch doesn't have a camera and in this case your app will crash on this device.
As Apple suggest in UIImagePickerController documentation:
To use an image picker controller
containing its default controls,
perform these steps:
1.Verify that the device is capable of picking content from the
desired source. Do this calling the
isSourceTypeAvailable: class method,
providing a constant from the
“UIImagePickerControllerSourceType”
enum.
2.Check which media types are available, for the source type you’re
using, by calling the
availableMediaTypesForSourceType:
class method. This lets you
distinguish between a camera that can
be used for video recording and one
that can be used only for still
images.
3.Tell the image picker controller to adjust the UI according to the
media types you want to make
available—still images, movies, or
both—by setting the mediaTypes
property.
4.Present the user interface by calling the
presentModalViewController:animated:
method of the currently active view
controller, passing your configured
image picker controller as the new
view controller.
5.When the user taps a button to pick a newly-captured or saved image
or movie, or cancels the operation,
dismiss the image picker using your
delegate object. For newly-captured
media, your delegate can then save it
to the Camera Roll on the device. For
previously-saved media, your delegate
can then use the image data according
to the purpose of your app.
So you have to call isSourceTypeAvailable and set your sourceType consistently.

Library photos as source to UIImage

How to give images in photo library and camera as source to UIImage
/* On button click i want to save image */
myImage = /*What i have to give here to take camera or library images*/
UIImageWriteToSavedPhotosAlbum(myImage, self,
#selector(image:didFinishSavingWithError:contextInfo:), nil);
You need to use the UIImagePickerController object. It will present the modal view that allows either taking a picture or selecting an image from the device library. You should also become familiar with the UIImagePickerControllerDelegate protocol. With these two, it is easy to interact with both the camera and on-device library.

iPhone SDK 3.0 Camera Access

Could anyone advise on whether the iPhone SDK 3.0 still does not allow access to the raw camera pixel data
This is how it was with all the previous SDKs and I thought it must have been a move by Apple to ensure they were the first ones to implement the video recording. Since 3.0 now has video recording, and as far as im aware the situation remains the same, then evidently I was wrong.
What I am wondering is what is apple playing at? Why aren't they allowing us to write crazy super-cool augmented reality applications on the iPhone.
Any ideas?
No, with SDK 3.0 and a new Iphone 3G S you can actually capture movies using the provide APIs.
You are restricted to 10 minutes video.
In the UIImagePickerControllerDelegate, you can now find UIImagePickerControllerMediaType.
This specifies the media type selected by the user. The value is an NSString object containing a type code such as kUTTypeImage or kUTTypeMovie.
This method has been added:
imagePickerController:didFinishPickingMediaWithInfo:
Tells the delegate that the user picked an image or movie. This method is optional.
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
Parameters
picker
The controller object managing the image picker interface.
info
A dictionary containing the original image and the edited image, if an image was picked; or a filesystem URL for the movie, if a movie was picked. The dictionary also contains any relevant editing information. The keys for this dictionary are listed in “Editing information keys.”
Discussion
Your delegate object’s implementation of this method should pass the specified media on to any custom code that needs it and then dismiss the picker view.
When editing is enabled, the picker view presents the user with a preview of the currently selected image or movie along with controls for modifying it. (This behavior is managed by the picker view prior to calling this method.) If the user modifies the image or movie, the editing information is available in the info parameter. The original image is also returned in the info parameter.
Maximum movie duration is 10 minutes. If a user picks a movie that is longer in duration than 10 minutes, they are forced to trim it before saving it.
Implementation of this method is optional, but expected.
Availability
Available in iPhone OS 3.0b and later.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
/* Now put some code here to either write it to a folder or play it
[self dismissModalViewControllerAnimated:YES];
}