Iphone Application:-My Application Crash

后端 未结 2 636
小蘑菇
小蘑菇 2020-12-22 08:45

I make one custom cell class like this.

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

self = [super initWith         


        
2条回答
  •  被撕碎了的回忆
    2020-12-22 08:58

    This is because you are doing some UI changes on background thread. In ios you can not perform any UI changes on background thread , this will crash your app.

    So you have to do your UI changes on main thread

    [self performSelectorOnMainThread:@selector(doYourUIChanges:) withObject:nil waitUntilDone:YES];  
    

    Or

    dispatch_async(dispatch_get_main_queue(), ^{ 
    //Your Task
    });
    

    or

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        // background code
    });
    

提交回复
热议问题