Mac OS 应用程序无法运行

问题描述 投票:0回答:1

你好,我正在尝试构建一个简单的网络浏览器,当我尝试在 xcode 构建器中运行该程序时,它说构建成功,然后出现错误并停止加载

错误:

argv    char ** 0x00007fff5fbff7b8
*argv   char *  0x00007fff5fbff940
**argv  char    '/(My Directory>>>>)'

输出:

2012-09-09 09:59:52.917 Snow Storm[29121:403] An uncaught exception was raised
2012-09-09 09:59:52.919 Snow Storm[29121:403] *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (WebView)
2012-09-09 09:59:52.924 Snow Storm[29121:403] (
    0   CoreFoundation                      0x00007fff85f6ef56 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff8cb2bd5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff85f6ed8a +[NSException raise:format:arguments:] + 106
    3   CoreFoundation                      0x00007fff85f6ed14 +[NSException raise:format:] + 116
    4   Foundation                          0x00007fff8d8bb705 _decodeObjectBinary + 2714
    5   Foundation                          0x00007fff8d8bc976 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1193
    6   Foundation                          0x00007fff8d89345c -[NSArray(NSArray) initWithCoder:] + 486
    7   Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    8   Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    9   AppKit                              0x00007fff8365cee6 -[NSView initWithCoder:] + 1051
    10  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    11  Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    12  AppKit                              0x00007fff8374dd1a -[NSWindowTemplate initWithCoder:] + 3998
    13  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    14  Foundation                          0x00007fff8d8bc976 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1193
    15  Foundation                          0x00007fff8d8bc377 -[NSSet(NSSet) initWithCoder:] + 519
    16  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    17  Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    18  AppKit                              0x00007fff83561871 -[NSIBObjectData initWithCoder:] + 2099
    19  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    20  Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    21  AppKit                              0x00007fff83560f1c loadNib + 235
    22  AppKit                              0x00007fff83560470 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
    23  AppKit                              0x00007fff8356038b +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
    24  AppKit                              0x00007fff835602ce +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
    25  AppKit                              0x00007fff837d106f NSApplicationMain + 398
    26  Snow Storm                          0x0000000100001472 main + 34
    27  Snow Storm                          0x0000000100001444 start + 52
)
2012-09-09 09:59:53.026 Snow Storm[29121:403] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (WebView)'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff85f6ef56 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff8cb2bd5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff85f6ed8a +[NSException raise:format:arguments:] + 106
    3   CoreFoundation                      0x00007fff85f6ed14 +[NSException raise:format:] + 116
    4   Foundation                          0x00007fff8d8bb705 _decodeObjectBinary + 2714
    5   Foundation                          0x00007fff8d8bc976 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1193
    6   Foundation                          0x00007fff8d89345c -[NSArray(NSArray) initWithCoder:] + 486
    7   Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    8   Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    9   AppKit                              0x00007fff8365cee6 -[NSView initWithCoder:] + 1051
    10  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    11  Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    12  AppKit                              0x00007fff8374dd1a -[NSWindowTemplate initWithCoder:] + 3998
    13  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    14  Foundation                          0x00007fff8d8bc976 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1193
    15  Foundation                          0x00007fff8d8bc377 -[NSSet(NSSet) initWithCoder:] + 519
    16  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    17  Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    18  AppKit                              0x00007fff83561871 -[NSIBObjectData initWithCoder:] + 2099
    19  Foundation                          0x00007fff8d8bb797 _decodeObjectBinary + 2860
    20  Foundation                          0x00007fff8d8baab2 _decodeObject + 201
    21  AppKit                              0x00007fff83560f1c loadNib + 235
    22  AppKit                              0x00007fff83560470 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
    23  AppKit                              0x00007fff8356038b +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
    24  AppKit                              0x00007fff835602ce +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
    25  AppKit                              0x00007fff837d106f NSApplicationMain + 398
    26  Snow Storm                          0x0000000100001472 main + 34
    27  Snow Storm                          0x0000000100001444 start + 52
)
terminate called throwing an exception(lldb) 

这就是它所指的:

int main(int argc, char *argv[])
{
    return NSApplicationMain(argc, (const char **)argv);
}

希望有人能帮忙

丹佛

objective-c
1个回答
37
投票

您应该将 WebKit.framework 添加到您的项目中。

© www.soinside.com 2019 - 2024. All rights reserved.