Search code examples
objective-ccgimage

Objective-C warning - Unable to get object ID - What does it mean?


I'm getting this warning in the logs: " Warning - Unable to get object ID". I've searched the nets but I can find no mention of it. It is happening when I take a screen image and add it to the simulator photo library.

The image is saved ok, so no harm is done, but I don't like messages I don't create for myself..

Anyone know what it means?

Here's the code that captures the screen image:

-(void)captureToPhotoAlbum {
    //NSLog(@"%s", __FUNCTION__);


    // Get image to save
    CGImageRef screen = UIGetScreenImage();
    UIImage *img = [UIImage imageWithCGImage:screen];

    //Test for Retina display:  
    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0) {
        // Retina
        // Image cropping This is the size of the saved image.
        CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], CGRectMake(0.0f, 230.0f, 1536.0f, 1640.0f));
        UIImage *img2Save = [UIImage imageWithCGImage:imageRef];
        CGImageRelease(imageRef);
        // Request to save the image to camera roll
        UIImageWriteToSavedPhotosAlbum(img2Save, self, nil, nil);

    } else {
        //Non Retina
        // Image cropping This is the size of the saved image.
        CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], CGRectMake(0.0f, 115.0f, 768.0f, 820.0f));
        UIImage *img2Save = [UIImage imageWithCGImage:imageRef];
        CGImageRelease(imageRef);
        // Request to save the image to camera roll
        UIImageWriteToSavedPhotosAlbum(img2Save, self, nil, nil);
    }

} 

Console Output:

Apr 30 20:29:52 Davids-MacPro.local AppName[25159] <Warning>: Unable to get object ID.
Apr 30 20:29:52 Davids-MacPro.local AppName[25159] <Warning>: Unable to get object ID.
Apr 30 20:29:52 Davids-MacPro.local AppName[25159] <Warning>: Unable to get object ID.
Apr 30 20:29:52 Davids-MacPro.local AppName[25159] <Warning>: Unable to get object ID.

Solution

  • I'm going to write this off. It appears that the warning only occurs when running on the Simulator. There is no warning when running on the devices.