Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CIContext createCGImage在iOS模拟器中返回nil_Ios_Ios Simulator_Alassetslibrary_Ciimage - Fatal编程技术网

CIContext createCGImage在iOS模拟器中返回nil

CIContext createCGImage在iOS模拟器中返回nil,ios,ios-simulator,alassetslibrary,ciimage,Ios,Ios Simulator,Alassetslibrary,Ciimage,我正在使用中提供的代码 它适用于大多数图像,但当我使用内置照片应用程序裁剪图像时,我通过[context createCGImage:fromRect]调用一直得到零。在花了很多时间尝试了各种各样的东西,但结果都是空的之后,我决定在我的iPhone5上试用它,令我惊讶的是,它成功了 这真的会在iOS模拟器中失败吗?或者我还需要做些什么才能让它在模拟器中工作?您能仔细检查一下代码,看看它的任何部分在模拟器中运行时是否出现故障或返回nil吗?例如,在模拟器中,XMP文件是否出于某种原因返回为零?似乎

我正在使用中提供的代码

它适用于大多数图像,但当我使用内置照片应用程序裁剪图像时,我通过
[context createCGImage:fromRect]
调用一直得到零。在花了很多时间尝试了各种各样的东西,但结果都是空的之后,我决定在我的iPhone5上试用它,令我惊讶的是,它成功了


这真的会在iOS模拟器中失败吗?或者我还需要做些什么才能让它在模拟器中工作?

您能仔细检查一下代码,看看它的任何部分在模拟器中运行时是否出现故障或返回nil吗?例如,在模拟器中,XMP文件是否出于某种原因返回为零?似乎您需要缩小失败部分的范围。所有步骤都按预期执行。传递到
[context createCGImage:fromRect]
图像
是有效的,
image.extent
也是有效的。只有这个调用返回nil。我使用Photos应用程序创建的裁剪图像最终有两个过滤器,并且使用任一过滤器的输出输入
createCGImage
,返回nil,即使过滤器产生非nil结果。