-4

I know the question has been asked a lot. but i haven't found an answer. Whenever my api returns anything other than statuscode 200 i get this error. It looks like it fails in ASIHTTPRequest. I am using afnetworking 1.3.2.

0x1001facd4:  b      0x1001fac8c               ; failWithError + 1608 at NRMAASISupport.m:265
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key 
HTTPMethod.'
*** First throw call stack:
(0x187e1a59c 0x19852c0e4 0x187e1a220 0x188cb80f4 0x188c050f0 0x1001fa834 0x1000faf00 0x1000fbbe8     
0x1000f193c 0x187d72ebc 0x187d7fcc0 0x187d729d4 0x18781e560 0x187d72ebc 0x187d72dd8 0x187dd29ec
0x187dd1c90 0x187dcfd40 0x187cfd0a4 0x187d4f1fc 0x10010578c 0x188cedc0c 0x198d4fe80 0x198d4fddc  0x198d4cfb0)
libc++abi.dylib: terminating with uncaught exception of type NSException
-(void)loginWithUser:(NSString*)user andPassword:(NSString*)password defaultCompany:(NSString*)companyId andDelegate:(id)delegate{
    NSString *URLString = [NSString stringWithFormat:@"%@/login/", self.baseURL];
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:URLString]];

    NSString *postString = [NSString stringWithFormat:@"<Login xmlns='http://schemas.datacontract.org/2004/07/Tamigo.Services.Entities'><DefaultCompanyId>%@</DefaultCompanyId><Email>%@</Email><Password>%@</Password></Login>", companyId, user, password];
    NSMutableData *data = [[postString dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];
    [request appendPostData:data];

    NSLog(@"postString: %@", postString);

    request.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:@"login", @"type", delegate, @"delegate", password, @"password", companyId, @"companyId", nil];
    [request addRequestHeader:@"Content-Type" value:@"application/xml"];
    request.delegate = self;

    [request setDidFinishSelector:@selector(loginFinished:)];
    [request startAsynchronous];
}

This call returns 401 Unauthorized and then the app crashes. If it returns 200 everything works.

After trying something new, i get an exception here. "CFRunLoopRun();" in ASIHTTPRequest

while (runAlways) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    CFRunLoopRun();
    [pool release];
}
Hbouazza
  • 1
  • 1
  • Post the code causing the issue and point out the exact line from the stack trace. – rmaddy Dec 15 '14 at 00:14
  • Where is NRMAASISupport.m line 265? – rmaddy Dec 15 '14 at 00:21
  • I don't know, but this is where xcode stops and says signal SIGABRT. But i would think it's in AFNetworking – Hbouazza Dec 15 '14 at 00:25
  • 1
    No one can help with the info you have provided. You haven't provided a usable stack trace and you haven't provided the code that actually crashes (NRMAASISupport.m line 265). – rmaddy Dec 15 '14 at 00:27
  • I'm sorry about that, and thank you for trying. But this is what i get from xcode, and that is way I can't fix myself. I tried something new and updated the question with where it crashes. – Hbouazza Dec 15 '14 at 00:31
  • You need to learn how to get the stack trace. – Hot Licks Dec 15 '14 at 00:47
  • 1
    But generally `not key value coding-compliant` means the same thing as `unrecognized selector` -- an attempt was made to invoke a method on an object, and that method is not defined for that object. This usually means that the wrong object has been used somewhere. There is a particular case where it occurs because the wrong class is named in a XIB or storyboard, but this appears to be the more general case -- you simply used the wrong object somewhere. Get that stack trace. – Hot Licks Dec 15 '14 at 00:54
  • @Hot Licks Yes i know, i'm rather new at developing for the iphone. Could you tell me how to get the stack trace you need. I appreciate the help. – Hbouazza Dec 15 '14 at 00:57
  • Unfortunately, getting the stack trace is kind of context dependent. There are several ways to do it, and different ones work in different places. At the risk if being accused of self-promotion, look [here](http://stackoverflow.com/q/8100054/581994) for some ideas. – Hot Licks Dec 15 '14 at 00:59

1 Answers1

0

I found out that the error was coming from an external plugin called new relic. After downgrading the plugin everything worked.

Update

Created a thread with new relic who created the framework. Thread for the issue.

Community
  • 1
  • 1
Hbouazza
  • 1
  • 1