iOS:在静态库中使用 UIApplicationDelegate 函数

发布于 2024-12-01 03:13:27 字数 159 浏览 3 评论 0原文

我想构建一个静态库来捕获传入的推送通知并使用“aps”命名空间之外的 json 对象。有没有什么方法可以在不更改 AppDelegate 中的 application:didReceiveRemoteNotification: 方法的情况下完成此操作,而只需添加和使用静态库?

提前致谢!

I want to build a static library that catches incoming push notifications and uses the json objects outside the "aps" namespace. Is there any way to do this without changing the application:didReceiveRemoteNotification: method in the AppDelegate but by simply adding and using the static library?

Thanks in advance!

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

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

发布评论

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

评论(1

二货你真萌 2024-12-08 03:13:27

不,没有办法做到你所要求的(据我所知)。首先,您可以执行类扩展或类别,但这两者都需要用户将它们导入应用程序委托中。此外,您可以“覆盖”该方法,但它不允许用户在其应用程序委托中“使用”该方法(如果他们还想在 didReceiveRemoteNotification 方法中执行某些逻辑)。

No, there isn't a way to do what you are asking (that I know of). First, you could do a class extension or category, but both would require the user to import them in the app delegate. Also, with that you could 'override' the method, but it wouldn't allow the user to 'use' that method in their app delegate (if they also wanted to perform some logic in the didReceiveRemoteNotification method).

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