请有人帮助我吗?我有下一个问题。我在xcode中创建了自定义键盘,并希望使用GCD在数组中加载gifs异步。但当我这样做我的应用程序崩溃。我的代码
@implementation KeyboardViewController
in viewDidLoad ()
dispatch_queue_t myQueue = dispatch_queue_create("identifier", NULL);
dispatch_async(myQueue, ^{
@synchronized (self.gifsArray){
@autoreleasepool {
for (int i = 0; i < NUMBER_OF_GIFS; i++) {
FLAnimatedImage *gifImage = [[FLAnimatedImage alloc] initWithAnimatedGIFData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%i", i] ofType:@"gif"]]];
[self.gifsArray addObject:gifImage];
}
}
}
});