完成时GCD Grand Central Dispatch async崩溃

时间:2012-11-29 10:39:34

标签: objective-c ios ipad grand-central-dispatch

在我的应用程序中,我需要使用Grand Central Dispatch(CGD)在后台执行大量操作(调整一组图像)。

我有类EngineViewController,它是应用程序的rootViewController:

AppDelegate.m

EngineViewController * engineVc = [[EngineViewController alloc]init];
self.window.rootViewController = engineVC;

viewDidAppear的{​​{1}}方法中,我有以下代码:

engineVC

方法- (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ //this method resize a set of image and save them in Document Folder of the app //this method needs about 40 seconds to perform all operations [[JSONParser sharedJSONParser]writeToDiskResizedImage]; NSLog(@"Finished"); }); } 返回后,[[JSONParser sharedJSONParser]writeToDiskResizedImage]在控制台中打印消息,应用程序崩溃。我的所有项目都是ARC,是NSLog课程的执行者。在控制台中没有错误消息;我只有这个:

enter image description here

JSONParser执行的代码如下:

[[JSONParser sharedJSONParser]writeToDiskResizedImage]

0 个答案:

没有答案