1

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.

some_id
  • 29,466
  • 62
  • 182
  • 304

2 Answers2

2

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];
WrightsCS
  • 50,551
  • 22
  • 134
  • 186
1

The following line just worked well enough for me (in OpenFeint SDK version 2.10i):

[[OFAchievement achievement:@"achievementID"] unlock];
WrightsCS
  • 50,551
  • 22
  • 134
  • 186
Erfan
  • 1,284
  • 1
  • 13
  • 21