为什么hook游戏频繁用CGContextDrawImage(就崩溃了

应该怎么看日志啊,这个我真是没法调试了,输出到这句就没了,所以应该是这吧,有时不崩有时蹦,不过蹦的还是多,uiimage是线程中1秒获取一张这样子调用的

我真不知道该怎么办了,data的长度还会变化真的头疼

没用过CG*这几个函数, 不过一般来说不是w * h * bpp, 而是 stride * h
而且, 你就贴半个函数, 谁懂啊

UIImage的获取

第一种获取rgba的方式直接上下文

第二种

调用在这里

-(CGContextRef)createARGBBitmapContextFromImage:(CGImageRef)inImage {

CGContextRef    context = NULL;
CGColorSpaceRef colorSpace;
void *          bitmapData;
int             bitmapByteCount;
int             bitmapBytesPerRow;

// Get image width, height. We'll use the entire image.
size_t pixelsWide = CGImageGetWidth(inImage);
size_t pixelsHigh = CGImageGetHeight(inImage);

// Declare the number of bytes per row. Each pixel in the bitmap in this
// example is represented by 4 bytes; 8 bits each of red, green, blue, and
// alpha.
bitmapBytesPerRow   = (int)(pixelsWide * 4);
bitmapByteCount     = (int)(bitmapBytesPerRow * pixelsHigh);

// Use the generic RGB color space.
colorSpace = CGColorSpaceCreateDeviceRGB();

if (colorSpace == NULL)
{
    fprintf(stderr, "Error allocating color space\n");
    return NULL;
}

// Allocate memory for image data. This is the destination in memory
// where any drawing to the bitmap context will be rendered.
bitmapData = malloc( bitmapByteCount );
if (bitmapData == NULL)
{
    fprintf (stderr, "Memory not allocated!");
    CGColorSpaceRelease( colorSpace );
    return NULL;
}

// Create the bitmap context. We want pre-multiplied ARGB, 8-bits
// per component. Regardless of what the source image format is
// (CMYK, Grayscale, and so on) it will be converted over to the format
// specified here by CGBitmapContextCreate.
context = CGBitmapContextCreate (bitmapData,
                                 pixelsWide,
                                 pixelsHigh,
                                 8,      // bits per component
                                 bitmapBytesPerRow,
                                 colorSpace,
                                 kCGImageAlphaPremultipliedFirst);
if (context == NULL)
{
    free (bitmapData);
    fprintf (stderr, "Context not created!");
}

// Make sure and release colorspace before returning
CGColorSpaceRelease( colorSpace );

return context;

}

大神请帮我看看是我那里错误了,实在是太困惑了

大神代码贴出来了,在线等你

大佬, 至少还有crash log吧

就是不会知道这个日志在哪里找啊:sob:大佬请说明白点

find / -name *.ips

崩在哪里已经很清楚了啊, 你自己对照一下

我这个不懂啊,有点超出我的能力了:confounded:

https://www.google.com/search?ie=UTF-8&q=ios+"Last+Exception+Backtrace"

https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-STACKTRACE