gpt4 book ai didi

objective-c - 将数据传递到AppDelegate

转载 作者:行者123 更新时间:2023-12-01 18:01:14 25 4
gpt4 key购买 nike

我想知道如何将数据传递回AppDelegate。假设我有这个方案

AppDelegate - > RootViewController -> FirstViewController -> SecondViewController.

SecondViewController包含应在调用AppDelegate applicationWillTerminate方法时保存的数据。我知道我可以使用单例在应用程序中共享数据,但是我不喜欢这种方法。在这种情况下,通知似乎无法正常工作。

你能推荐我什么?

最佳答案

这应该得到那个代表。

AppDelegate * delegate =(AppDelegate*) [UIApplication sharedApplication].delegate
[delegate callSomeMethod:someData];

关于objective-c - 将数据传递到AppDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9546482/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com