iOS使用MBProgressHUD出现的坑

2018-01-04  本文已影响0人  超人_22

今天在使用MBProgressHUD时崩了,提示如下图

显示错误提示MBMainThreadAssert();

点击看了下说明如下:

#define MBMainThreadAssert() NSAssert([NSThread isMainThread], @"MBProgressHUD needs to be accessed on the main thread.");

提示必须在主线程中访问。

解决办法:

    dispatch_async(dispatch_get_main_queue(), ^{
        hud.minShowTime = 6;
        [hud show:YES];

    });

上一篇 下一篇

猜你喜欢

热点阅读