 |
BOOK: Beginning iOS 4 Application Development
 | This is the forum to discuss the Wrox book Beginning iOS 4 Application Development by Wei-Meng Lee; ISBN: 978-0-470-91802-9 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning iOS 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 25th, 2012, 03:47 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Chapter 13: rect undefined
In .m Lines
"//---get the cropping rectangle applied to the image---
CGRect rect = [[info valueForKey:UIImagePickerControllerCropRect] CGRectValue];"
I am getting an undefined for "rect" above. When I downloaded and ran the sample code I received the same error message.
Also, how do I add pics to the simulator so the simulator can display actual pictures when this runs?
Thanks for the help.
|
|

April 25th, 2012, 10:38 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
More information ...
rect in line "CGRect rect = [[info valueForKey:UIImagePickerControllerCropRect] CGRectValue];"
is found on page 330, Under Accessing the PhotoLibrary in step #8. and located in the PhotoLibraryViewController.m file.
Since the same undefined error occurs with the downloaded code from wrox, I am hoping someone has come across this and can help.
|
|

April 25th, 2012, 11:18 AM
|
|
Friend of Wrox
|
|
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;
or
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.
Bob
|
|

April 25th, 2012, 12:21 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Working better ...
Thanks!. I can now list the photo albums and select a picture with the sample code. But I can not do anything with the picture I selected or even move to the next picture unless I reload all the pics. Did I miss something or need another change?
|
|

April 25th, 2012, 01:12 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
|
|
What are you expecting to be able to do with the image? The project doesn't appear to go beyond accessing and displaying the image. The imagePickerController is modal so it hides when the image is shown, if it did not then it would cover the display of the selected image. So the choices (in the imagePicker)and selected image can not be visible simultaneously. That is why the imagePicker must present, then hide after the selection.
Clarify what you think is missing from functionality.
Bob
|
|

April 25th, 2012, 02:32 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
My misunderstanding. Sorry. I thought you could flip through pictures using this method. I'll need a different method it appears. Thanks for the help.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Chapter 11 - Undefined attributes in manifest.xml file |
dbaechtel |
BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 |
1 |
September 4th, 2009 07:50 AM |
| Re: Undefined offset: 1 chapter 5 form.php |
sreenivasharish |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
0 |
November 9th, 2008 06:08 PM |
| Chapter 13 problem(undefined index) |
linux-penguin |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
2 |
February 15th, 2008 06:10 AM |
| Chapter 7 check_image.php, undefined variable |
Ron_Bingham |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 |
2 |
June 3rd, 2005 10:31 PM |
| Undefined Variable - Chapter 4 |
JohnAlden |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 |
21 |
August 25th, 2004 11:55 AM |
|
 |
|