Frage

I just started learning cocoa programming. I tried to build a simple imageviewer. I created a new project then added a image viewer from the object library. The problem is that I get an error that I can't even find by googling.

2012-04-21 20:36:20.620 ImageViewer[2095:403] An uncaught exception was raised
2012-04-21 20:36:20.621 ImageViewer[2095:403] *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (IKImageView)
2012-04-21 20:36:20.624 ImageViewer[2095:403] (
    0   CoreFoundation                      0x00007fff83a42fc6 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff89dd3d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff83a42dfa +[NSException raise:format:arguments:] + 106
    3   CoreFoundation                      0x00007fff83a42d84 +[NSException raise:format:] + 116
    4   Foundation                          0x00007fff8b957729 _decodeObjectBinary + 2714
    5   Foundation                          0x00007fff8b95899a -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1193
    6   Foundation                          0x00007fff8b92f480 -[NSArray(NSArray) initWithCoder:] + 486
    7   Foundation                          0x00007fff8b9577bb _decodeObjectBinary + 2860
    8   Foundation                          0x00007fff8b956ad6 _decodeObject + 201
    9   AppKit                              0x00007fff8eceac18 -[NSView initWithCoder:] + 1051
    10  Foundation                          0x00007fff8b9577bb _decodeObjectBinary + 2860
    11  Foundation                          0x00007fff8b956ad6 _decodeObject + 201
    12  AppKit                              0x00007fff8eddc106 -[NSWindowTemplate initWithCoder:] + 3998
    13  Foundation                          0x00007fff8b9577bb _decodeObjectBinary + 2860
    14  Foundation                          0x00007fff8b95899a -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1193
    15  Foundation                          0x00007fff8b95839b -[NSSet(NSSet) initWithCoder:] + 519
    16  Foundation                          0x00007fff8b9577bb _decodeObjectBinary + 2860
    17  Foundation                          0x00007fff8b956ad6 _decodeObject + 201
    18  AppKit                              0x00007fff8ebed99d -[NSIBObjectData initWithCoder:] + 2099
    19  Foundation                          0x00007fff8b9577bb _decodeObjectBinary + 2860
    20  Foundation                          0x00007fff8b956ad6 _decodeObject + 201
    21  AppKit                              0x00007fff8ebed048 loadNib + 235
    22  AppKit                              0x00007fff8ebec59c +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
    23  AppKit                              0x00007fff8ebec4b7 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
    24  AppKit                              0x00007fff8ebec3fa +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
    25  AppKit                              0x00007fff8ee5f9b3 NSApplicationMain + 398
    26  ImageViewer                         0x00000001087035a2 main + 34
    27  ImageViewer                         0x0000000108703574 start + 52
    28  ???                                 0x0000000000000003 0x0 + 3
)

It looks like..I need to link a framework, but cocoa framework has been linked already.

Are there any other things I need to check?

War es hilfreich?

Lösung

The stack trace is complaining about a missing IKImageView class which is part of ImageKit which in turn is part of the Quartz framework.

You will need to add the Quartz.framework to the project.

Andere Tipps

-[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (IKImageView)

Did you add the ImageKit framework to your project? Your app won't contain the code that defines an IKImageView unless you do.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top