Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.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
Objective c GLKTextureInfo与iPad Air上的自崩溃一起使用?_Objective C_Ipad_Opengl Es_Self_Glkit - Fatal编程技术网

Objective c GLKTextureInfo与iPad Air上的自崩溃一起使用?

Objective c GLKTextureInfo与iPad Air上的自崩溃一起使用?,objective-c,ipad,opengl-es,self,glkit,Objective C,Ipad,Opengl Es,Self,Glkit,我有一个应用程序,它在以前的iPad迭代中运行良好,但在新的iPad Air上崩溃 崩溃发生在此行,错误为EXE\u BAD\u ACCESS: self.textureInfo = [GLKTextureLoader textureWithContentsOfData:imageData options:options error:&error]; if (self.textureInfo == nil) { NSLog(@"Error loading texture

我有一个应用程序,它在以前的
iPad
迭代中运行良好,但在新的
iPad Air
上崩溃

崩溃发生在此行,错误为
EXE\u BAD\u ACCESS

self.textureInfo = [GLKTextureLoader textureWithContentsOfData:imageData options:options error:&error];     
if (self.textureInfo == nil) {
    NSLog(@"Error loading texture file %@", [error localizedDescription]);
    return nil;
}

我正在尝试解决这个问题。有人能提出为什么这可能是一个问题,而完全相同的代码在所有其他设备上工作?此代码正在线程上运行。

为了结束此问题,我将重申我在上面的评论中所做的:

一般来说,当我遇到像这样突然出现在一类或另一类设备上的奇怪OpenGL ES崩溃时,我总是检查是否同时访问同一OpenGL ES上下文。如果您同时从多个线程访问给定的OpenGL ES上下文,则会发生不好的事情,包括这样的崩溃


我的首选处理方法是将对给定OpenGL ES上下文的访问包装在GCD串行调度队列的块中。这保证了对上下文的安全访问,而没有锁的开销。它也很容易在代码中实现。

是否有可能同时访问它所在的OpenGL ES上下文?对我来说,这听起来像是一种竞赛状态,iPad Air的性能特征略有不同,这就触发了竞赛状态。嗨,布拉德,我认为这是可能的。如何防止/排除此问题?我通常对每个上下文使用串行调度队列,并向其调度任何与该上下文相关的内容。这保证了串行访问,但避免了昂贵的锁。它也很容易实现。我在创建对象时只传递了一个上下文,即在本例中,PolygonObject*newStand=[[PolygonObject alloc]initWithVertices:stand.sorteddvertices effect:self.effect withContext:self.context和statuscolor:[UIColor grayColor]standlab:[nsstringwithformat:@“%@”,展位号]];这被包装在dispatch_async(newQueue^{