Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 25th, 2012, 03:47 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
Reply With Quote
  #2 (permalink)  
Old April 25th, 2012, 10:38 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
Reply With Quote
  #3 (permalink)  
Old April 25th, 2012, 11:18 AM
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
Default

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
Reply With Quote
  #4 (permalink)  
Old April 25th, 2012, 12:21 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?
Reply With Quote
  #5 (permalink)  
Old April 25th, 2012, 01:12 PM
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
Default

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
Reply With Quote
  #6 (permalink)  
Old April 25th, 2012, 02:32 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 05: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 05: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



All times are GMT -4. The time now is 05:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.