这个错误是因为你把一个字符串类型的值传递给了一个期望接收NSNotification.Name类型的参数。

要解决这个问题,你需要将字符串转换为NSNotification.Name类型。你可以使用NSNotification.Name的初始化方法来实现这一点。例如:

let notificationName = NSNotification.Name(rawValue: "YourNotificationName")

然后,你可以将notificationName作为参数传递给期望接收NSNotification.Name类型的方法。

希望能对你有所帮助!

Cannot convert value of type String to expected argument type NSNotificationName如何解决

原文地址: https://www.cveoy.top/t/topic/hJis 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录