我在我的项目中单独建立了一个model类,用来进行数据请求,当数据请求成功时,发送Notification,在viewController中向消息中心注册了对应的执行方法,在这个方法中我做了隐藏MBProgressHuD的操作。但运行的时候Hud却没有隐藏掉,我通过打印日志,发现这个方法中打印的currentThread和主线程中打印的线程信息不一致。所以有几个问题想问:
1.注册到消息中心的方法可能不在主线程中执行?在什么情况下不会。
2.MBProgressHud在什么特殊情况下隐藏会出现问题?
Solved, for notifications sent in other threads, the corresponding execution methods are also executed in other threads, not in the main thread.
The data request is executed in other threads, so the method of registering to the message center is also executed in other threads, so MBProgressHUD is not hidden.