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 = "\($0.map{$0.content.title})"
}
}
相关问题
- App crash when presenting UIAlertController [dupli
- read/write local json file swift 4
- Xcode 9 simulator doesn't save userdefaults
- Bool.hashValue valid to convert to Int?
- Simultaneous accesses to 0x10f10df48, but modifica
相关文章
- Open iOS 11 Files app via URL Scheme or some other
- Convert received Int to Bool decoding JSON using C
- Making NSDecimalNumber Codable
- Xcode 9 simulator remove frames
- Inheritance of Encodable Class
- Convert string JSON response to a boolean using Sw
- is it possible to turn off wifi or switch iPhone t
- Checking Http Status Swift4
You are using
$0
insideasync { }
closure. This closure expects no arguments, which means using$0
argument shortcut is invalid.You are evidently attempting to refer to
requests
array fromgetPendingNotificationRequests
callback. The reason you can't by using$0
is that it's screened byDispatchQueue.main.async{ ... }
closure with no arguments:Try this:
The rule for
$0
claims that$0
always refers to current scope. Thus, to access closure argument from nested closure, that argument must be named (requests
in the above code).