CGContextSaveGState 无效上下文

2024-05-04

我正在开发一个 iOS 应用程序,它使用实时摄像头扫描条形码和二维码。然而有时我会遇到错误..这些错误不会使应用程序崩溃,但修复它们可能是个好主意。这些是错误:

<Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetAlpha: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextTranslateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextScaleCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextDrawImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextRestoreGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetInterpolationQuality: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetAllowsAntialiasing: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextTranslateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextScaleCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextFlush: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGBitmapContextCreateImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetInterpolationQuality: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetAllowsAntialiasing: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextTranslateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextScaleCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextFlush: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGBitmapContextCreateImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

我相信这段代码是导致错误消息的原因:

- (UIImage *)cropImage:(UIImage *)oldImage sideCrop:(float)crop {
CGSize imageSize = oldImage.size;
UIGraphicsBeginImageContextWithOptions( CGSizeMake( imageSize.width - 2*crop,
                                                   imageSize.height ),
                                       NO,
                                       0.);
[oldImage drawAtPoint:CGPointMake( -crop, 0)
            blendMode:kCGBlendModeCopy
                alpha:1.];
UIImage *croppedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return croppedImage;
} 

The UIGraphicsBeginImageContextWithOptions方法正在通过任一方式传递大小width = 0 and/or height = 0。调试并解决问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

CGContextSaveGState 无效上下文 的相关文章

随机推荐

  • C++ 私有和受保护的虚拟方法

    似乎最好将虚拟方法设为私有 以便分离以下两个客户端的接口 1 实例化对象并调用方法的客户端 2 从该类派生并可能想要重写该方法的客户端 简而言之 第一个客户端不需要知道方法是否是虚拟的 他将调用基类公共非虚拟方法 该方法又将调用私有虚拟方法
  • 如何将 char * 转换为 BSTR?

    如何将 char 从 C dll 传递到 VB 这是示例代码 void Cfunc char buffer int len BSTR buf bstr SysAllocString BSTR buffer VBptr VBfunc buf
  • 进行 URL 重写

    当我点击网站上给定条目的评论部分时 URL 如下所示 http www com comments index php submission Portugal 20Crushes 20North 20Korea submissionid 62
  • 运行玩笑测试时,Firebase 在signInAnonymously() 上抛出“auth/network-request-failed”

    我正在使用 firebase 为我的应用程序 使用 create react app 构建 编写一些测试 并且我正在尝试匿名登录我的测试数据库 但认证失败 然而 所有其他 Firebase 操作 CRUD 都工作得很好 我还可以从在浏览器中
  • JavaFX - 如何检测 Windows 注销/关闭请求?

    我有一个应用程序必须在退出时处理一些方法 但是 当用户在没有先关闭我的应用程序的情况下关闭 Windows 时 Windows 会终止该应用程序并且不会运行关闭方法 如何检测用户何时请求关闭或注销 Windows 我需要运行的方法需要几毫秒
  • 使用 ffmpeg 将 h.264 avi 容器转换为 mp4

    我想使用 ffmpeg 将 h 264 avi 容器转换为 mp4 容器 我发现这个有效 ffmpeg i myfile avi vcodec copy myfile mp4 ffmpeg version N 51169 gcedf276
  • 服务无法放置任务

    好吧 我不知道在哪里可以解决这个问题 我正在尝试启动一个堆栈 其中有一个在 ECS 中运行的基本应用程序 我将在下面展示云信息 但我不断得到 服务 sos ecs SosEcsService 1RVB1U5QXTY9S 无法放置任务 因为没
  • 初始化 FingerpringManager.Crypto 对象,获取 AndroidKeyStore 提供程序不支持的加密原语?

    我使用的是安卓FingerPrintManagerAPI 并使用 KeyPairGenerator 创建密钥对 我想用公钥加密密码 然后在用户通过输入指纹进行身份验证时解密 但是一旦我运行我的项目 它就会崩溃并给出 引起原因 java la
  • 在最后(或第四次)出现“.”时分割字符串分隔符

    我喜欢按如下方式分隔字符串 给定以下字符串 Column 1 10 80 111 199 1345 127 0 0 1 3279 我想在最后一个 之后分隔数字 这将得到以下输出 Column 1 Column 2 10 1 12 5 134
  • Opencart 2.2.0 启用按制造商搜索

    我正在使用 OC 2 2 0 并一直在努力解决以下问题 示例 我在标题搜索中输入西门子 然后单击 显示所有结果 我的搜索页面将显示所有结果 问题是 结果列表仅包含名称中包含西门子的产品 我需要的是展示all 搜索结果列表中属于该制造商的产品
  • AJAX Webmethod 调用在 MVC3 上返回 404

    我一直在使用 EXTJS 4 并通过 AJAX 调用 aspx 页面代码隐藏上的 Webmethod 来加载我的商店 此方法适用于我的所有项目 直到我尝试将 EXTJS 4 工作移植到 MVC3 项目中 我的电话现在返回 404 关键部分是
  • stdClass 类的对象无法转换为字符串

    我现在在使用 PHP 时遇到问题 收到此错误 Object of class stdClass could not be converted to string当我在我的网站中运行这部分代码时发生错误 function myaccount
  • 列表:Count 与 Count() [重复]

    这个问题在这里已经有答案了 给定一个列表 首选哪种方法来确定内部元素的数量 var myList new List
  • 从控制器传递 gsp 参数

    我如何通过不是域类实例的控制器将参数传递到groovy服务器页面 您将参数放入返回给 GSP 的模型对象映射中 例如 def index def hobbies basketball photography render view inde
  • 如何在 Django 查询中动态提供查找字段名称? [复制]

    这个问题在这里已经有答案了 我想在 Django 模型的几个字段中查找某个字符串 理想情况下 它会类似于 keyword keyword fields foo bar baz results for field in fields look
  • jQuery 函数在不应该运行的时候运行

    我有一个函数 仅当宽度小于特定值时才需要运行 我已经这样做了if window width lt n 但当宽度大于 n 时 该函数也会运行 The if if window width lt n 由于背景颜色发生变化 浅灰色 1000px
  • VBA - 从 Internet Explorer 的框架通知栏中选择另存为

    我正在尝试通过以下方式下载另存为的文件框架通知栏的互联网浏览器 然而 经过大量搜索后 我只找到了点击解决方案save在框架通知栏上 到目前为止 我一直在尝试另存为示例站点上的文件 http www tvsubtitles net subti
  • Angular 5 webpack 3 aot

    我正在尝试使用 webpack 3 和 Angular 5 进行 aot 构建 但是网上有很多教程 没有一个没有问题地显示完整的示例 到目前为止我已经有了以下配置 对于那些对路径有疑问的人 我在 java 应用程序中使用它 webpack
  • Azure DataCache Windows Azure 模拟器出现问题,但未生成错误。应用程序只是挂起

    我有一个现有的 mvc4 Web 项目 我想将其部署到云服务并开始使用 azure 数据缓存 我已将 Windows azure 缓存 nuget 包添加到解决方案中的两个项目中 即 Web 项目和类库项目 这两个项目都需要这些项目 然后
  • CGContextSaveGState 无效上下文

    我正在开发一个 iOS 应用程序 它使用实时摄像头扫描条形码和二维码 然而有时我会遇到错误 这些错误不会使应用程序崩溃 但修复它们可能是个好主意 这些是错误