【发布时间】:2023-04-01 07:15:01
【问题描述】:
这里的代码一定有问题:
+ (UIImage*)captureView:(UIView *)theView {
UIGraphicsBeginImageContext(theView.frame.size);
[theView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
当我使用它时,Xcode 会抛出这个错误消息:
malloc: * 对象错误 0x103f000: 没有被释放的指针 已分配 * 在 malloc_error_break 中设置断点进行调试
我在那里看不到任何内存管理错误。还有其他人吗?
【问题讨论】:
-
你是否像它告诉你的那样在
malloc_error_break上设置了断点?如果是,调用堆栈是什么?
标签: iphone memory-management core-graphics quartz-graphics quartz-2d