誰でも私を助けることができますか?次の問題があります。xcode でカスタム キーボードを作成し、GCD を使用して gif を非同期で配列にロードしたいと考えています。しかし、これを行うとアプリがクラッシュします。私のコード
@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];
}
}
}
});