我目前正试图在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
任何人都可以帮忙吗?
答案 0 :(得分:2)
如果您的应用程序启动以编程方式实例化并且遇到了此问题,请查看您的 Info.plist 中是否有 NSPrincipalClass 键。如果有,请将其删除并查看会发生什么。
答案 1 :(得分:1)
在应用的info.plist中,确保将NSPrincipalClass键更改为子类的名称。这将使Cocoa在应用程序加载时实例化正确的类 - 您不必为了让子类工作而执行除此之外的任何操作。此外,看看这个链接,它也可能会为您的问题添加一些见解。 Demystifying NSApplication