小编Som*_*per的帖子

swift - 如何从系统函数的完成处理程序闭包内返回?

我知道这不行,因为它completion handler是在一个background Thread但是

我应该在哪里派遣主队列或我还需要做什么?

这是代码:

static func isNotificationNotDetermined() -> Bool{

    var isNotDetermined = false

    UNUserNotificationCenter.current().getNotificationSettings { (notificationSettings) in
        switch notificationSettings.authorizationStatus {
        case .notDetermined:
            isNotDetermined = true

        case .authorized:
            isNotDetermined = false

        case .denied:
            isNotDetermined = false

        }
    }

    return isNotDetermined
}
Run Code Online (Sandbox Code Playgroud)

completionhandler swift

2
推荐指数
1
解决办法
1376
查看次数

标签 统计

completionhandler ×1

swift ×1