我目前正在尝试在 Xcode 上运行我用 Qt 制作的应用程序,但是当我尝试在 Xcode 上运行它时,我得到了这个异常:
dyld: warning, Ignoring DYLD_IMAGE_SUFFIX because DYLD_ROOT_PATH is used.
2016-10-10 15:37:04.777 CMP[2206:654538] *** Assertion failure in void _UIApplicationMainPreparations(int, char **, NSString *__strong, NSString *__strong)(), /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UIApplication.m:3702
2016-10-10 15:37:04.783 CMP[2206:654538] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to instantiate the UIApplication subclass instance. No class named NSApplication is loaded.'
*** First throw call stack:
(
0 CoreFoundation 0x06a27494 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x07c4fe02 objc_exception_throw + 50
2 CoreFoundation 0x06a2732a +[NSException raise:format:arguments:] + 138
3 Foundation 0x05eba390 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 102
4 UIKit 0x04703177 _UIApplicationMainPreparations + 645
5 UIKit 0x04702e73 UIApplicationMain + 90
6 CMP 0x0004f6f6 qt_main_wrapper + 678
7 libdyld.dylib 0x0b53fa25 start + 1
8 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
有人可以帮忙吗?
最佳答案
在您应用的 info.plist 中,确保将 NSPrincipalClass 键更改为您的子类的名称。这将使 Cocoa 在应用程序加载时实例化正确的类——除此之外你不需要做任何其他事情来让你的子类工作。另外,请查看此链接,它也可能会为您的问题添加一些见解。 Demystifying NSApplication
关于ios - Xcode 错误 NSException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39966420/