【发布时间】:2014-01-07 16:15:50
【问题描述】:
我有一个应用程序在 iPad 的先前迭代中运行良好,但在新的 iPad Air 上崩溃。
崩溃发生在这一行,错误为EXE_BAD_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 上下文?在我看来,这听起来像是一种竞争条件,现在是由 iPad Air 的性能特征略有不同而触发的。
-
嗨布拉德 - 我认为这是可能的。我该如何预防/解决这个问题?
-
我通常为每个上下文使用一个串行调度队列,并将任何涉及该上下文的内容调度给它。这保证了串行访问,同时避免了昂贵的锁。它也很容易实现。
-
在创建对象时我只有一个上下文,即在这种情况下 PolygonObject * newStand = [[PolygonObject alloc]initWithVertices:stand.sortedVertices effect:self.effect withContext:self.context andStatusColour:[UIColor grayColor] standLabel:[NSString stringWithFormat:@"%@", stand.standNumber]];
-
这被包裹在 dispatch_async(newQueue, ^{
标签: objective-c ipad opengl-es self glkit