开发者

Apples's Scrolling Example Crashes

I am trying to run the Apple's Scrolling Sample Code, but I get following Error:

Scrolling[45877:207] Unknown class ScrollingAppDelegate in Interface Builder file.
Scrolling[45877:207] Unknown class ScrollingViewController in Interface Builder file.
Scrolling[45877:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UICustomObject 0x4b33330> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key viewController.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00f0cbe9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x010615c2 objc_exception_throw + 47
    2   CoreFoundation                      0x00f0cb21 -[NSException raise] + 17
    3   Foundation                          0x000306cf _NSSetUsingKeyValueSetter + 135
    4   Foundation                          0x0003063d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    5   UIKit                               0x004af8d6 -[UIRuntimeOutletConnection connect] + 112
    6   CoreFoundation                      0x00e832cf -[NSArray makeObjectsPerformSelector:] + 239
    7   UIKit                               0x004ae2ed -[UINib instantiateWithOwner:options:] + 1041
    8   UIKit                               0x004b0081 -[NSBundle(UINSBun开发者_如何学编程dleAdditions) loadNibNamed:owner:options:] + 168
    9   UIKit                               0x002ba943 -[UIApplication _loadMainNibFile] + 172
    10  UIKit                               0x002bb4ca -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
    11  UIKit                               0x002c5db2 -[UIApplication handleEvent:withNewEvent:] + 1533
    12  UIKit                               0x002be202 -[UIApplication sendEvent:] + 71
    13  UIKit                               0x002c3732 _UIApplicationHandleEvent + 7576
    14  GraphicsServices                    0x01842a36 PurpleEventCallback + 1550
    15  CoreFoundation                      0x00eee064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x00e4e6f7 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x00e4b983 __CFRunLoopRun + 979
    18  CoreFoundation                      0x00e4b240 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x00e4b161 CFRunLoopRunInMode + 97
    20  UIKit                               0x002bafa8 -[UIApplication _run] + 636
    21  UIKit                               0x002c742e UIApplicationMain + 1160
    22  Scrolling                           0x0000279c main + 102
    23  Scrolling                           0x0000272d start + 53
)
terminate called after throwing an instance of 'NSException'

The weird thing is, that I can't find those connections in the MainWindow.xib (The only xib file). The Outlets are properly connected to the AppDelegate and MyViewController classes.


The Runtime cannot find a way to create an instance of the classes "ScrollingAppDelegate" and "ScrollingViewController", which are serialized in the xib file. So it defaults to UICustomObject, which you don't have either.

Are you sure those classes exist in your source file(s) and that they are compiled correctly (i.e., part of the "Compile" build phase)?

Also check the spelling and the capitalization of the classes. It has to match between the xib files and the source files.

If something is wrong, there could be a yellow warning dot in the xib file (bottom-right). Click it for more info.

Finally, the sample code is marked as iOS4+. Do you have iOS 4 on your device?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜