迅速迁移:'通知'在此上下文中,对于类型的查找而言,这是模棱两可的'在某些地方

发布于 2025-01-23 08:42:51 字数 752 浏览 1 评论 0原文

我正在从Swift 2.3迁移到Swift 5,这很痛苦,好吧,我正在结束迁移,但我仍在代码的某些地方遇到错误:

Notification'在此上下文中查找

我在此错误之前收到了收到的收到,但是现在我在这样的地方收到了此信息

var notifications = [Notification]
self.notifications = (sql.execute() as NSArray) as! [Notification]

 func isAlreadyExists(notification: Notification) -> Bool {

我想更改通知名称,但是该应用程序不是我的,而且很大...非常大,无法做到这,好吧,我不知道该怎么办。

提前致谢。

编辑: 尝试做与我如何消除具有相同名称的类型和模块?,但要做“ import(class | struct | func | stolops | enum)module.symbol” des不起作用(我知道通知在哪里该项目但不起作用projectName.class)。

I'm making a migration from Swift 2.3 to Swift 5 with a lot of pain and well, I'm ending the migration but I'm still getting an error in some places of the code:

Notification' is ambiguous for type lookup in this context

I recieved before this error but now I'm getting this in places like

var notifications = [Notification]
self.notifications = (sql.execute() as NSArray) as! [Notification]

and

 func isAlreadyExists(notification: Notification) -> Bool {

I thought to change Notification name but the app is not mine and is big... very big and is not possible to do this and well, I don't know what to do.

Thanks in advance.

Edit:
Tried to do the same as suggested in How can I disambiguate a type and a module with the same name? but doing "import (class|struct|func|protocol|enum) Module.Symbol" desn't works (I see where Notification is in the project but doesn't work ProjectName.class).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流心雨 2025-01-30 08:42:51

最后,它通过更改类名并将其添加到名为< project_name> -bridging-Header的文件中来起作用。

这样做我可以用var example =< project_name>。className>来调用课程。

Finally, it worked by changing the class name and adding it to a file called <Project_name>-Bridging-Header.

Doing this I could call the class with var example = <Project_name>.<className>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文