/** 在主线程执行block */
+ (void)gs_synExecuteOnMainThread:(void (^)(void))block {
if ((nil == block) || (NULL == block)) {
return;
}
if ([NSThread isMainThread]) {
block();
}else {
dispatch_sync(dispatch_get_main_queue(), ^{
block();
});
}
}
/** 在异步主线程执行block */
+ (void)gs_asynExecuteOnMainThread:(void (^)(void))block {
if ((nil == block) || (NULL == block)) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
block();
});
}