Unrecognized selector to an openfeint unlock achievement call - iphone

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.

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];

The following line just worked well enough for me (in OpenFeint SDK version 2.10i):
[[OFAchievement achievement:#"achievementID"] unlock];

Related

App crash when call imei method

-[UIDevice imei]: unrecognized selector sent to instance 0x1f566990
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[UIDevice imei]: unrecognized selector sent to instance 0x1f566990'
*** First throw call stack:
(0x376962a3 0x359a697f 0x37699e07 0x37698531 0x375eff68 0xb7465 0x38986595 0x389db13b
0x389db081 0x389daf65 0x389dae89 0x389da5c9 0x389da4b1 0x389c8b93 0x389c8833 0xb34fd
0x38a520ad 0x38a5205f 0x38a5203d 0x38a518f3 0x38a51de9 0x3897a5f9 0x38967809 0x38967123
0x37b1a5a3 0x37b1a1d3 0x3766b173 0x3766b117 0x37669f99 0x375dcebd 0x375dcd49 0x37b192eb
0x389bb301 0xb38d3 0xb3028)
libc++abi.dylib: terminate called throwing an exception
Myxcode version 4.6.2 please help.
There's no method called imei on the UIDevice class as provided by Apple, so when you try to call it you get a crash.
That said, there is such a method in Erica Sadun's UIDevice extensions - perhaps you're reusing code that assumes that they're present - so if you add them to your project then your code should work as you expect.

iOS - Video playing gives errors

When I follow this tutorial, it gives me an error on the [playercontroller release]; line, so I remove it, and then it gives me these errors when I try to run it.
I tried making another app to test the video, and it works seamlessly, but it will not work in my main app. Can anyone help?
And when I reimported the framework, and tried to play the video, it gives me this error:
2012-08-17 11:27:03.174 LYWAM Tour[768:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(0x1e15022 0x10fdcd6 0x1dbda48 0x1dbd9b9 0xba253b 0xba24c5 0x54ac 0x1e16e99 0x26314e 0x2630e6 0x309ade 0x309fa7 0x308d8a 0x2882cf 0x2885e6 0x26edc4 0x262634 0x16f7ef5 0x1de9195 0x1d4dff2 0x1d4c8da 0x1d4bd84 0x1d4bc9b 0x16f67d8 0x16f688a 0x260626 0x24cd 0x2435 0x1)
terminate called throwing an exception(lldb)
I take it GVE1ViewController is a class you wrote yourself? Does it definitely implement a method called GrommeVideoExcerpt1? Is what you assigned to the variable actually an instance of GVE1ViewController (or a subclass?) Put in an NSLog to check that it really is an instance of GVE1ViewController.
To do the NSLog, you need a line of the form:
NSLog(#" My controller = %#", myVar);
where myVar is whatever variable you have containing a reference to the GVE1ViewController.

Why am I getting an "unrecognised selector sent to instance" error when I have defined the method?

I'm building an iOS (5.1) app on Xcode (4.4.1), and I'm almost done with the first phase of development, but I'm stuck on the final line of code. I've been using Kumulos as a backend & API solution, and at the moment all the API is working fine except for this bit:
Kumulos* k = [[Kumulos alloc]init];
[k setDelegate:self];
[k createNewTimePointWithJourneyIDFK:[journeyID integerValue]
andTime:currentDate andLat:[lat floatValue] andLon:[lon floatValue]];
When it hits the createNewTimePointWithJourneyIDFK: method, it terminates. In the log it mentions this method and says an unrecognised selector was sent to an instance.
Now I realise this question has been asked a million times on SO, but I've 1) checked that the method has been defined, and 2) that it has been called correctly (or at least to the best of my knowledge). The way I've done the above is the way I've done the rest of the API calls, and they work well, so I can't see what the problem is. Very frustrating, I've spent hours on this last line! So please don't think I've come hear after a few minutes of not knowing what to do.
The error message
2012-08-11 22:36:58.769 busApp4Kumulos[5485:707] -[Kumulos
createNewTimePointWithJourneyIDFK:andTime:andLat:andLon:]:
unrecognizedselector sent to instance 0x3d1b70 2012-08-11 22:36:58.778
busApp4Kumulos[5485:707]
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[Kumulos
createNewTimePointWithJourneyIDFK:andTime:andLat:andLon:]:
unrecognized selector sent to instance 0x3d1b70'
*** First throw call stack:
(0x35add88f 0x37e84259 0x35ae0a9b 0x35adf915 0x35a3a650 0x3ef5
0x37f86de3 0x37f86785 0x37f80e3f 0x35ab1b01 0x35ab112f 0x35ab0351
0x35a334a5 0x35a3336d 0x376cf439 0x3353fcd5 0x2dd9 0x2d74)
terminate called throwing an exception(lldb)
The Method
This is located in the Kumulos.m file.
-(KSAPIOperation*) createNewTimePointWithJourneyIDFK:(NSInteger)journeyIDFK
andTime:(NSDate*)time andLat:(float)lat andLon:(float)lon{
NSMutableDictionary* theParams = [[NSMutableDictionary alloc]init];
[theParams setValue:[NSNumber numberWithInt:journeyIDFK] forKey:#"journeyIDFK"];
[theParams setValue:time forKey:#"time"];
[theParams setValue:[NSNumber numberWithFloat:lat] forKey:#"lat"];
[theParams setValue:[NSNumber numberWithFloat:lon] forKey:#"lon"];
KSAPIOperation* newOp = [[KSAPIOperation alloc]initWithAPIKey:theAPIKey
andSecretKey:theSecretKey andMethodName:#"createNewTimePoint"
andParams:theParams];
[newOp setDelegate:self];
[newOp setUseSSL:useSSL];
//we pass the method signature for the kumulosProxy callback on this thread
[newOp setCallbackSelector:#selector( kumulosAPI: apiOperation: createNewTimePointDidCompleteWithResult:)];
[newOp setSuccessCallbackMethodSignature:[self methodSignatureForSelector:#selector(apiOperation: didCompleteWithResult:)]];
[newOp setErrorCallbackMethodSignature:[self methodSignatureForSelector:#selector(apiOperation: didFailWithError:)]];
[opQueue addOperation:newOp];
return newOp;
}
The only thing I can think of is that something got stale in your project. Have you tried cleaning (via Product → Clean) and rebuilding?

PayPal Button unrecognized selector?

I am just writing code for paypal button as below in ViewDidLoad
UIButton *button = [[PayPal getInstance] getPayButtonWithTarget:self andAction:#selector(payWithPayPal) andButtonType:BUTTON_278x43];
and getting the crash as following
2011-11-17 05:41:39.541 MothProject[654:707] -[PayPal getPayButtonWithTarget:andAction:andButtonType:andButtonText:]: unrecognized selector sent to instance 0x2bd2d0
2011-11-17 05:41:39.548 MothProject[654:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PayPal getPayButtonWithTarget:andAction:andButtonType:andButtonText:]: unrecognized selector sent to instance 0x2bd2d0'
*** First throw call stack:
(0x328d78bf 0x367411e5 0x328daacb 0x328d9945 0x32834680 0x8f9b 0x311837ff 0x3118fc39 0x3118faa9 0x3118f98f 0x3118f15b 0x3118ef53 0x31183673 0x31183349 0x77ad 0x311fd565 0x31275ce7 0x37a6e943 0x328aba63 0x328ab6c9 0x328aa29f 0x3282d4dd 0x3282d3a5 0x37f6efed 0x31178743 0x2831 0x27c8)
terminate called throwing an exceptionProgram received signal: “SIGABRT”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Can't find dlopen function, so it is not possible to load shared libraries.)
I have used implemented all required delegate methods in self, and also used Delegate too,
What is issue, does anyone has idea about it?
I think you need to initialize the instance of PayPal first, using the method
-initializeWithAppID:forEnvironment:

Error: "-[NSCFString sizeWithTextStyle:]: unrecognized selector" in IPhone SDK

I get the following error while running my app.
'-[NSCFString sizeWithTextStyle:]: unrecognized selector
I have not used sizeWithTextStyle in my entire project.
So what could be wrong?
I get error on return pos; statement below
Code:
(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *pos = [[UIView alloc] initWithFrame:CGRectMake(0.0,0.0,320.0,35.0)];
return pos;
}
Error in Console:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 0x7044b50'
Because of indentation problem while putting whole crash log here, I am putting the screenshot of the crash log
I think, the problem is somewhere else, not in this line of code. The object is not able to retain itself. Post the code, where you are using the sizeWithTextStyle method
Have you the -all_load flag on your link settings?
This issue comes up a lot. You need to add -all_load and -ObjC to your applications link flags.
*EDIT : *
Crash appears to occur on line:
CGSize textSize = [self.text sizeWithTextStyle:textStyle];
in class: CPTextLayer method: sizeToFit
which is called from within class CPTextLayer method initWithText:
-(id)initWithText:(NSString *)newText style:(CPTextStyle *)newStyle
....
[self sizeToFit];
**try to set with iOS 4 and not with 3.1.3 **
When you have memory management issues (selectors being sent to the wrong instances is one symptom of memory management issues), there are a number of things you can do:
Re-read the Cocoa memory management rules and make sure that you're following them.
Run the static analyser. This will often pick up places where you have neglected the memory management rules.
Try using NSZombieEnabled to find out whether [and when] you are sending messages to unallocated instances.
I am also getting same error but now it's solved.
Need to do simple thing, set the value of Other linker flag.
below I have mention the steps.
Project name - Build Setting - Other linker flag (use search bar to search) - "-ObjC"
You should change your code to use pointers like this:
UIView *pos = [[UIView alloc] initWithFrame:CGRectMake(0.0,0.0,320.0,35.0)];
return pos;
Pay attention to asterisk!
And of course the ; in the end of allocation statement!