Rotation warnings


#1

Hi,

I think we’re stuck with this one. Apple have changed from a two stage animation sequence to a single stage sequence but it appears that they overlooked the UIImagePickerController. As it’s inside their class we can’t get at the internals to change this.

I tried adding the willAnimateSecondHalfOfRotationFromInterfaceOrientation method to see if this forced it to use the single-stage approach but still got the messages.

It is only an advisory message though and not an actual error - so nothing to worry about.

Gareth


#2

I’m getting similar behavior, but instead of just a warning, I’m getting a crash. I’m developing the app on the iPad using sdk 3.2 When I click the photo button to bring up the image picker I get the following crash details:

2010-07-07 07:35:13.405 Homepwner[750:207] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘On iPad, UIImagePickerController must be presented via UIPopoverController’

The code works fine in the simulator (sdk 4.0) however when I go to select an image, the photo library is empty.

I was able to add the following code to ItemDetailViewController to get a pop up controller working, and to get the image to show up in the imageView, but I’m getting low memory warnings, which makes me feel like I’m missing something. I’d love to have some feedback if anyone has a chance

[assuming your code is in the state just after Figure 13.7, and you’ve implemented the imagePickerController:didFinishPickingMediaWithInfo method)]

ItemDetailViewController.h

  • add the UIPopoverControllerDelegate delegate at the top
  • add UIPopoverController *popController variable (and make it a property)

ItemDetailViewController.m

  • synthesize popController
  • release popController in dealloc
  • implement:
  • (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
    {
    [popController release];
    popController = nil;
    }

*inside takePicture:

  • comment out [self presentModalViewController:imagePicker animated:YES];

*add the following above commented out line:

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController: imagePicker];

popController = popover;
[popController presentPopoverFromBarButtonItem:[[self navigationItem] rightBarButtonItem] permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

#3

Hi,

Haven’t dabbled much yet on the iPad but a few observations - doubt it will solve it but may get you a bit further hopefully.

  1. are you invoking [popController dismissPopoverAnimated:YES]; in the didFinishPickingMediaWithInfo method ?

  2. Have you set the popController delegate to self ?

  3. What is the popController = popover for ? Why not just assign popController directly ?

BTW you can get a photo into the simulator by launching Safari (in the simulator) drag a picture from your hard drive onto a blank page.
Click and hold the picture until popup menu appears and then choose “Save Image”

Gareth


#4

Blah, thanks for reminding me about this as I write the 2nd edition. I’ll post some code when I get that far.


#5

[quote=“GarethR”]Hi,

Haven’t dabbled much yet on the iPad but a few observations - doubt it will solve it but may get you a bit further hopefully.

  1. are you invoking [popController dismissPopoverAnimated:YES]; in the didFinishPickingMediaWithInfo method ?

  2. Have you set the popController delegate to self ?

  3. What is the popController = popover for ? Why not just assign popController directly ?

BTW you can get a photo into the simulator by launching Safari (in the simulator) drag a picture from your hard drive onto a blank page.
Click and hold the picture until popup menu appears and then choose “Save Image”

Gareth[/quote]
Thanks for the tips, I’ll look into #1 and #2. Regarding #3, it was stale code that I prolly don’t need (still a bit new to the show here )

The code as posted does work, but I do notice if I don’t dismiss the pop up myself (by tapping on the screen) it still shows when I go back to the main possessions view (which I’m guessing will be solved by your #1 suggestion.


#6

Interesting thing I notice here, maybe related to these warning maybe not.
When testing this app on my iPhone 3GS test phone, the first time I try to load the Camera UI, it takes about 8 seconds to load it, a very noticeable time. once its loaded once, the next time I need to load that camera GUI it loads in a more reasonable and user friendly way. Any reason for that?
I assume there is some caching happening somewhere when loading the camera UI for the first time, but its a huge delay, anyway of speeding it up?