我如何将这些打印文本放入文本字​​段?

how can i put these print text into Textfield?

UNUserNotificationCenter.current().getPendingNotificationRequests {

    DispatchQueue.main.async{//Contextual closure type '() -> Void' expects 0 arguments, but 1 was used in closure body
     let str:String = ""
     self.finalresulter.text = str
     self.finalresulter.text = "\([=10=].map{[=10=].content.title})"
     }
    }

您正在 async { } 闭包中使用 [=11=]。这个闭包不需要参数,这意味着使用 [=11=] 参数快捷方式是无效的。

您显然试图从 getPendingNotificationRequests 回调中引用 requests 数组。你不能使用 [=11=] 的原因是它被 DispatchQueue.main.async{ ... } 没有参数的闭包屏蔽:

试试这个:

    UNUserNotificationCenter.current().getPendingNotificationRequests { requests in
        DispatchQueue.main.async{
            let str:String = ""
            self.finalresulter.text = str
            self.finalresulter.text = "\(requests.map{[=10=].content.title})"
        }
    }

[=11=] 的规则声称 [=11=] 总是指当前范围 。因此,要从嵌套闭包访问闭包参数,必须命名该参数(上面代码中的requests)。