gpt4 book ai didi

ios - AppDelegate valueForUndefinedKey

转载 作者:行者123 更新时间:2023-11-30 11:37:18 32 4
gpt4 key购买 nike

我正在快速制作一个应用程序,但我遇到了一些问题。我正在尝试运行我的应用程序,但每次都会出现错误。

这是完整的错误: *** 由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[ valueForUndefinedKey:]:此类与键 currentUnityController 不兼容键值编码。”

在 AppDelegate 中我使用这样的服务:

@UIApplicationMain
final class AppDelegate: AppwiseCore.AppDelegate<Config> {
override var services: [ApplicationService] {
return [
UnityApplicationService(),
FabricApplicationService(),
KeyboardManagerApplicationService()
]
}
}

然后我像这样调用 UnityAppcontroller:

var window: UIWindow?

var application: UIApplication?
@objc var currentUnityController: UnityAppController!
var isUnityRunning = false

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.application = application
unity_init(CommandLine.argc, CommandLine.unsafeArgv)
currentUnityController = UnityAppController()
currentUnityController.application(application, didFinishLaunchingWithOptions: launchOptions)

startUnity()
return true
}

最后,这就是我访问应用程序 Controller 的方式。

NS_INLINE UnityAppController* GetAppController()
{
NSObject<UIApplicationDelegate>* delegate = [UIApplication sharedApplication].delegate;
UnityAppController* currentUnityController = (UnityAppController*)[delegate valueForKey: @"currentUnityController"];
return currentUnityController;

}

安妮帮忙吗?

最佳答案

如果您的 nib(xib 文件)中有一个链接到 View Controller 中的属性 (IBOutlet) 或方法 (IBAction) 的控件,并且您已删除或重命名该属性或方法,则运行时可以'找不到它,因为它已被重命名,因此崩溃了。

关于ios - AppDelegate valueForUndefinedKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49610115/

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