mjoishy / oauth

Automatically exported from code.google.com/p/oauth
0 stars 0 forks source link

Objc: NSRangeException when PUT/POST #233

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When I try to execute a code like that:

{{{
id<OASignatureProviding> signatureProvider = [[OAPlaintextSignatureProvider 
alloc] init];
            OAMutableURLRequest *oauthRequest = [[OAMutableURLRequest alloc] initWithURL:[NSURL URLWithString:self.auxApiURL] consumer:self.auxOAuthConsumer token:self.auxOAuthToken realm:nil signatureProvider:signatureProvider];
            [oauthRequest setHTTPMethod:@"PUT"];
            [oauthRequest setHTTPBody:deleteJSON];

            [oauthRequest prepare];
}}}

I get a NSRangeException:
{{{
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** 
-[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(0x13a1012 0x1169e7e 0x1356b44 0x95e7 0x10d9c 0x10096 0x8890 0x117d705 0xf8ce 
0xc6fe59 0xc6df22 0xc6f16a 0xc6dedd 0xc6e055 0xbbb338 0x498da81 0x498cd33 
0x49cae3a 0x13438fd 0x49cb4bc 0x49cb435 0x48b53a0 0x1324f3f 0x132496f 0x1347734 
0x1346f44 0x1346e1b 0x22267e3 0x2226668 0xb165c 0x2ba5 0x2aa5 0x1)
libc++abi.dylib: terminate called throwing an exception
}}}

I see a little patch in the Ubuntu One source code that I think that solves the 
problem:
http://bazaar.launchpad.net/~jose-exposito89/ubuntuone-ios-files/social-networki
ng/view/head:/Dependencies/ShareKit/Classes/ShareKit/Core/Helpers/OAuth/Categori
es/NSMutableURLRequest%2BParameters.m#L36

Original issue reported on code.google.com by jose.exposito89@gmail.com on 27 Nov 2012 at 6:52