GCD不适用于自定义键盘

时间:2014-10-20 11:35:40

标签: ios objective-c grand-central-dispatch custom-keyboard

请有人帮助我吗?我有下一个问题。我在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];
            }

        }
        }
    });

0 个答案:

没有答案