Search code examples
iphoneopenfeint

Unrecognized selector to an openfeint unlock achievement call


I use the call as it is supposed to be used, but it causes a crash.

//someId is a correct achievement ID
[OFAchievementService unlockAchievement:@"someId"];

and I get the following error

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[OFAchievementService unlockAchievement:]: unrecognized selector sent to class 0x26f1c8'

I also get a warning

warning: 'OFAchievementService' may not respond to '+unlockAchievement:'

How is one supposed to call this function? This looks correct according to examples.


Solution

  • Try:

    OFAchievementService *openfeint = [[OFAchievementService alloc] init];
    [openfeint unlockAchievement:@"someId"];
    [openfeint release];
    

    instance methods begin with - class level methods begin with +.

    With OpenFeint SDK 2.7+ try:

    /* The following example shows how to unlock an achievement completely in one step without bothering to show a notification: */
    [[OFAchievement achievement: achievementId] updateProgressionComplete: 100.0f andShowNotification: NO];