我在日志中收到此警告:“警告 - 无法获取对象 ID”。我已经搜索了网络,但我找不到任何提及它。当我拍摄屏幕图像并将其添加到模拟器照片库时,就会发生这种情况。
图像保存正常,所以没有伤害,但我不喜欢我不为自己创建的消息..
有谁知道是什么意思?
这是捕获屏幕图像的代码:
-(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);
}
}
控制台输出:
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.