View Single Post
  #3 (permalink)  
Old April 25th, 2012, 11:18 AM
thepianoguy thepianoguy is offline
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts

I don't have the book but working form the downloaded code…

A simple way to add photos to the PhotoLibrary is to run Safari in the simulator then drop an image into the browser window. Click and hold on the image and you will be given the option to save the image.

You will need to change the btnClicked: method to use either

imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;


imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

the line the author has commented out. Since you are not using the camera you should comment out the lines following the //-invoke the camera comment through the // -show the ImagePicker comment. These lines will cause a crash on the simulator since no camera exists.

The CGRect that is giving an "unused" (you said "undefined", I am not getting that) warning is irrelevant as the program is written, since this rect can only exist if you use the camera and crop the photo. The warning can be ignored, and since without using the camera that branch of the if-else will never be reached anyway.