• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
debugging an iOS silent app crash on device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

debugging an iOS silent app crash on device


  • Subject: debugging an iOS silent app crash on device
  • From: Jean-Denis Muys <email@hidden>
  • Date: Mon, 28 Mar 2011 14:59:43 +0000
  • Thread-topic: debugging an iOS silent app crash on device

This question is as much an iOS question than an Xcode 4.01 question, perhaps more. I apologize if you think this is the wrong list and will shut up if told so.

My iOS app runs fine on the simulator, but crashes on the device.

In fact "crash" is perhaps incorrect. The symptoms are:

- the crash happens when stepping over this code line: [self drawInRect:destRect]; where "self" is a UIImage
- the app display all go away, showing the springboard.
- the Xcode button is still enabled, suggesting that my app is still running.
- the debugger console doesn't report anything *at all*: no error, no exception, nothing
- the debug navigator is empty and only shows "Process Running"
- the pause/continue button is in its "continue" state (right pointing arrow), just as it was before stepping over. pressing it does nothing
- pressing my app icon on the device's multitasking bar restarts it from scratch.
- pressing Xcode's stop button seems to kill the app, but without any additional output in the debugger console

The code is from a small category I wrote on UIImage to draw thumbnails for images. It's quite straightforward and shown entirely below.

My suspicion is that this problem is memory related, as the image I am trying to scale down here is 6622x9361 pixels in a 6 MB JPEG file.
But none of my AppDelegate related routines is called

How can I confirm this? Is there any debugging technique I can use?

Jean-Denis


- (UIImage *) copyScaledTo:(CGFloat) newScale
{
    UIImage *resultImage;
    NSDate *chronoStart = [NSDate date];

    if (NO) {
        resultImage = [[UIImage alloc] initWithCGImage:self.CGImage scale:1.0/newScale orientation:self.imageOrientation];
        // this doesn't work: initWithCGImage:scale:orientation: doesn't resample. It only change the bounds
    } else {
        CGRect sourceRect = CGRectZero;
        sourceRect.size= self.size;
        CGRect destRect = (CGRect){{0.0, 0.0}, {sourceRect.size.width * newScale, sourceRect.size.height * newScale}};

        

        // Create a low res image representation of the source image to display before the TiledJPEGView
        // renders its content.
        UIGraphicsBeginImageContext(destRect.size);

        

        CGContextRef context = UIGraphicsGetCurrentContext();

        

        // First fill the background with white.
        CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0);
        CGContextFillRect(context,destRect);

        

        CGContextSaveGState(context);
        // Flip the context so that the image is rendered
        // right side up.
        if (false) { // necessary for PDF, not for images
            CGContextTranslateCTM(context, 0.0, destRect.size.height);
            CGContextScaleCTM(context, 1.0, -1.0);
        }
        // Scale the context so that the image is rendered 
        // at the correct size for the zoom level.
        // CGContextScaleCTM(context, newScale, newScale);
            // in fact, its incorrect to do that, as scaling is already handled by sizing of destRect
            // we must do either, but not both

        

        [self drawInRect:destRect];

        

        CGContextRestoreGState(context);
        resultImage = [UIGraphicsGetImageFromCurrentImageContext() retain];
        UIGraphicsEndImageContext();
    }

    NSDate *chronoStop = [NSDate date];
    NSTimeInterval chrono = [chronoStop timeIntervalSinceDate:chronoStart];
    NSLog(@"Thumbnail for %@ image scaled to %.1f%% at %@ in %.2f ms", NSStringFromCGSize(self.size), newScale*100, NSStringFromCGSize(resultImage.size), chrono*1000);

        

    return resultImage;
}

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: debugging an iOS silent app crash on device
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: RE: Mac OS 10.5 is "pretty old now" ?
  • Next by Date: Xcode4: GCC_AUTO_VECTORIZATION gone?
  • Previous by thread: Re: CLang wrong analysis?
  • Next by thread: Re: debugging an iOS silent app crash on device
  • Index(es):
    • Date
    • Thread