views:

60

answers:

2

I recently tried to integrate open feint into my app. When my app launches, the 'Welcome back player xxxx' at the bottom works so I know that open feint is working. However, when I press the button that has this linked to it

-(IBAction) leaderboard: (id) sender
{

 [OpenFeint launchDashboard];
}

I get this error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DemoAppViewController leaderboard]: unrecognized selector sent to instance 0x7a40250'
*** Call stack at first throw:

(
 0   CoreFoundation                      0x02d71919 __exceptionPreprocess + 185
 1   libobjc.A.dylib                     0x02ebf5de objc_exception_throw + 47
 2   CoreFoundation                      0x02d7342b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
 3   CoreFoundation                      0x02ce3116 ___forwarding___ + 966
 4   CoreFoundation                      0x02ce2cd2 _CF_forwarding_prep_0 + 50
 5   UIKit                               0x00695e14 -[UIApplication sendAction:to:from:forEvent:] + 119
 6   UIKit                               0x0071f6c8 -[UIControl sendAction:to:forEvent:] + 67
 7   UIKit                               0x00721b4a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
 8   UIKit                               0x007206f7 -[UIControl touchesEnded:withEvent:] + 458
 9   UIKit                               0x006b92ff -[UIWindow _sendTouchesForEvent:] + 567
 10  UIKit                               0x0069b1ec -[UIApplication sendEvent:] + 447
 11  UIKit                               0x0069fac4 _UIApplicationHandleEvent + 7495
 12  GraphicsServices                    0x032f3afa PurpleEventCallback + 1578
 13  CoreFoundation                      0x02d52dc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
 14  CoreFoundation                      0x02cb3737 __CFRunLoopDoSource1 + 215
 15  CoreFoundation                      0x02cb09c3 __CFRunLoopRun + 979
 16  CoreFoundation                      0x02cb0280 CFRunLoopRunSpecific + 208
 17  CoreFoundation                      0x02cb01a1 CFRunLoopRunInMode + 97
 18  GraphicsServices                    0x032f22c8 GSEventRunModal + 217
 19  GraphicsServices                    0x032f238d GSEventRun + 115
 20  UIKit                               0x006a3b58 UIApplicationMain + 1160
 21  DemoApp                             0x00004f84 main + 102
 22  DemoApp                             0x00004f15 start + 53
)

terminate called after throwing an instance of 'NSException'

I haven't been able to find any post on how to resolve this so any help would be greatly appreciated! Thanks in advance

A: 

From the exception it looks to me as if you tried to message your object with leaderboard when the method requires one argument and as such you should call it with one.

That is, it looks like you are doing something like this:

[someDemoAppViewControllerObject leaderboard]

When your should be doing this:

[someDemoAppViewControllerObject leaderboard:theSenderObject]

Quite often self is used as theSenderObject.

rastersize
A: 

is

-(IBAction) leaderboard: (id) sender

declared in the .h file?

jenningj
If it wasn't, he would just receive a compiler warning telling him that the class might not respond to that selector. Wouldn't cause any exception at runtime as the selector is implemented and thus exists when the instance is sent a message.
rastersize