NSDictionary: fail to parse [__NSCFNumber length]: unrecognized selector sent to instance - objective-c

I'm having issue parsing a dictionary object returned in a json message from a webservice. The json is valid as AFNetworking is parsing it successfully. The actual response is below:
{
error = FALSE;
"error_desc" = "";
images = (
{
hasItem = 0;
image = "https://image/php4A6Xb8";
imageGroupId = 28;
"image_date" = "06/07/2014";
"image_id" = 863;
tag = "MCMOBILE-06072014-033902";
thumb = "https://image/thumbs/php4A6Xb8";
}
);
}
With this response my code does the following:
- (void) successResponseImages: (NSDictionary *) dictionary {
NSLog(#"Success: %#", dictionary);
NSString *error = [ dictionary objectForKey:#"error"];
NSString *errorDesc = [ dictionary objectForKey:#"error_desc"];
NSArray *images = [ dictionary objectForKey:#"images"];
....
At this point all values are correct and images is an array of 7 items.
i then try to loop through images using:
for (NSDictionary * image in images) {
NSLog([image objectForKey:#"image_id"]); <<<<fail
NSLog([image objectForKey:#"image"]);
NSLog([image objectForKey:#"thumb"]);
}
At fail it bombs out with the following error:
2014-07-06 15:44:19.161 mycobber[8976:60b] -[__NSCFNumber length]: unrecognized selector sent to instance 0x9ad2690
I'm not sure what the problem is.
EDIT: fuller stack trace
2014-07-06 15:44:19.292 mycobber[8976:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x9ad2690'
*** First throw call stack:
(
0 CoreFoundation 0x0214f1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01ece8e5 objc_exception_throw + 44
2 CoreFoundation 0x021ec243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0213f50b ___forwarding___ + 1019
4 CoreFoundation 0x0213f0ee _CF_forwarding_prep_0 + 14
5 CoreFoundation 0x020cf89c CFStringGetLength + 140

The first argument to NSLog is a format string, but your dictionary has a number set for its #"image_id" key. NSLog tries to treat this as a string by asking for its length, but this doesn't work because NSNumber has no such method. The format string to print a single object is #"%#".

Your code looks correct only. But your nslog statement is not correct and also no need to write stringwithformat as well just simply write like that below, it works -
NSLog(#"%#",[image objectForKey:#"image_id"]);

cracked it:
NSLog([NSString stringWithFormat:#"%#",[image objectForKey:#"image_id"]]);

Related

UITableView Alphabetizing

I have a UITableView that is successfully populated from a database, put into a NSArray and every cell is clickable and performs the correct action when selected, however the list is out of alphabetical order. In order to sort them into alphabetical order, I use the following code:
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:#"Name" ascending:YES];
sortedArray = [buildings sortedArrayUsingDescriptors:[NSArray arrayWithObject:sort]];
The alphabetizing works correctly, however when some of the cells (in this example it was the first cell in the list) are clicked the app terminates with an uncaught exception:
'NSRangeException' '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
I'd be happy to post more code excerpts, I am just unsure of what relevant information would be needed to help answer this question.
Edit:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger r = [indexPath row];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if(infoInst != nil) {
infoInst = nil;
}
infoInst = [[DirInfoListing alloc] initWithNibName:#"DirInfoListing" bundle:nil building:[self.listData objectAtIndex:r] map:mapUI];
NSLog(#"infoInst building: %#", [self.listData objectAtIndex:r]);
NSString *deviceType = [UIDevice currentDevice].model;
if([deviceType isEqualToString:#"iPad"] || [deviceType isEqualToString:#"iPad Simulator"]){
[self presentModalViewController:infoInst animated:YES];
} else {
[self.navigationController pushViewController:infoInst animated:YES];
}
}
Edit: Here is the stack trace immediately before the error is thrown
2013-07-03 16:56:56.579 thestanforddaily[32907:1a303] Stack trace : (
0 thestanforddaily 0x002190d9 -[Directory tableView:didSelectRowAtIndexPath:] + 457
1 UIKit 0x01ae871d -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1164
2 UIKit 0x01ae8952 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 201
3 Foundation 0x0237086d __NSFireDelayedPerform + 389
4 CoreFoundation 0x02acd966 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
5 CoreFoundation 0x02acd407 __CFRunLoopDoTimer + 551
6 CoreFoundation 0x02a307c0 __CFRunLoopRun + 1888
7 CoreFoundation 0x02a2fdb4 CFRunLoopRunSpecific + 212
8 CoreFoundation 0x02a2fccb CFRunLoopRunInMode + 123
9 GraphicsServices 0x0327b879 GSEventRunModal + 207
10 GraphicsServices 0x0327b93e GSEventRun + 114
11 UIKit 0x01a58a9b UIApplicationMain + 1175
12 thestanforddaily 0x00002f4d main + 141
13 thestanforddaily 0x00002e75 start + 53
)
2013-07-03 16:57:13.740 thestanforddaily[32907:1a303] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(0x2af9052 0x28e8d0a 0x2ae5db8 0x21cb0e 0x1b1e64e 0x1b1e941 0x1b3047d 0x1b3066f 0x1b3093b 0x1b313df 0x1b31986 0x1b315a4 0x219250 0x1ae871d 0x1ae8952 0x237086d 0x2acd966 0x2acd407 0x2a307c0 0x2a2fdb4 0x2a2fccb 0x327b879 0x327b93e 0x1a58a9b 0x2f4d 0x2e75)
Thank you!
The only array access I see in didSelectRowAtIndexPath is [self.listData objectAtIndex:r]. So it would seem your listData array isn't in sync with the table's data model. From the code you posted, the array sortedArray should correspond to the data model, so make sure listData and sortedArray are kept in sync or just have one array. If you still can't figure it out, please post your UITableViewDataSource methods as well as the methods where you set up your various array variables.
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:#"Name" ascending:YES];
sortedArray = [buildings count] <= 1 ? buildings : [buildings sortedArrayUsingDescriptors:[NSArray arrayWithObject:sort]];
Unless you require sortedArray to be a different instance than buildings. Then you should change the statement accordingly.

NSInvalidArgumentException when calling selector with arguments

I'm trying to execute a method using selector with one NSString as parameter and fails. I have seen many questions (and answers) like this and tried most solutions but had no success. Please see code and errors below:
My MainView.m is my view controller and it has a method:
-(void)displayMessageOnTextView:(NSString *)message
{
[tv1 setText:message];
}
And in MainView.h:
#interface MainView : UIViewController {
UITextView *tv1;
}
-(void)displayMessageOnTextView:(NSString *)message;
....
I have another thread which is fired by MainView (this is from MainView.m):
- (void) runTest
{
MyThread *t = [[MyThread alloc] initWithInt:13253];
[t setMainView:self];
[t run];
[t release];
}
and MyThread.m:
#import "MyThread.h"
#import "MainView.h"
#implementation MyThread
MainView *_view;
-(id)initWithInt:(int)someInt{
_view = NULL;
return self;
}
-(void)setMainView:(MainView*)view
{
_view = view;
}
-(int)run{
NSString *s = [NSString stringWithFormat:#"Display on Gui:%d", 1];
[_view performSelectorOnMainThread:#selector(displayMessageOnTextView:message:) withObject:s waitUntilDone:YES];
}
#end
Error:
2011-04-20 02:08:11.553 myApp[22627:207] -[MainView displayMessageOnTextView:message:]: unrecognized selector sent to instance 0x4e383a0
2011-04-20 02:08:11.555 myApp[22627:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainView displayMessageOnTextView:message:]: unrecognized selector sent to instance 0x4e383a0'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc55a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f19313 objc_exception_throw + 44
2 CoreFoundation 0x00dc70bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d36966 ___forwarding___ + 966
4 CoreFoundation 0x00d36522 _CF_forwarding_prep_0 + 50
5 Foundation 0x0079e94e __NSThreadPerformPerform + 251
6 CoreFoundation 0x00da68ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
7 CoreFoundation 0x00d0488b __CFRunLoopDoSources0 + 571
8 CoreFoundation 0x00d03d86 __CFRunLoopRun + 470
9 CoreFoundation 0x00d03840 CFRunLoopRunSpecific + 208
10 CoreFoundation 0x00d03761 CFRunLoopRunInMode + 97
11 GraphicsServices 0x00ffd1c4 GSEventRunModal + 217
12 GraphicsServices 0x00ffd289 GSEventRun + 115
13 UIKit 0x00025c93 UIApplicationMain + 1160
14 myApp 0x000024c9 main + 121
15 myApp 0x00002445 start + 53
)
terminate called after throwing an instance of 'NSException'
NOTE:
I'm new to Objective-C (and generally iOS) programming, so any comment regarding coding conventions and best practice will be appreciated (even if not related to my question, but related to my code)
Your method has been declared as
-(void)displayMessageOnTextView:(NSString *)message;
This means that the method name is displayMessageOnTextView: and the corresponding selector is #selector(displayMessageOnTextView:). Note that a method name does not include parameter (variable) names.
In your -run method, change
[_view performSelectorOnMainThread:#selector(displayMessageOnTextView:message:)
withObject:s
waitUntilDone:YES];
to
[_view performSelectorOnMainThread:#selector(displayMessageOnTextView:)
withObject:s
waitUntilDone:YES];
and that runtime error shouldn’t happen again.
For the record, a method declaration corresponding to displayMessageOnTextView:message: would be:
- (void)displayMessageOnTextView:(type1)parameter1 message:(type2)parameter2;
This method:
-(void)displayMessageOnTextView:(NSString *)message
has the selector displayMessageOnTextView:. The name of the parameter itself (message in your case) does not appear in the selector. (This should be sort of intuitive: the name doesn't necessarily appear when you call the method, so it doesn't appear in the selector.) So you need to be using #selector(displayMessageOnTextView:).

Variable is Not A CFString Error

Hey fellas, while running through a debugger I am seeing the following appear the second time it sets the variables (timestamp and checksum are set through this method one after the other, it works fine when no DataFeedManager exists, but upon returning to it again it crashes when it's time to set the checksum):
Here is the function of interest:
//sets specified attribute to the passed in value while ensuring that only one instance of the DataFeedManager exists
-(void)setItemInDFMWhilePreservingEntityUniquenessForItem:(attribute)attr withValue:(id)value {
SJLog(#"CoreDataSingleton.m setItemInDFMWhilePreservingEntityUniquenessForItem");
NSError *error;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:#"DataFeedManager" inManagedObjectContext:[self managedObjectContext]];
[fetchRequest setEntity:entity];
NSUInteger numEntities = [[self managedObjectContext] countForFetchRequest:fetchRequest error:&error];
if (numEntities == NSNotFound) { // ERROR
//...
} else if (numEntities == 0) {
DataFeedManager *dfm = (DataFeedManager *)[NSEntityDescription insertNewObjectForEntityForName:#"DataFeedManager"
inManagedObjectContext:[self managedObjectContext]];
if (attr == checksumAttr) { //BLOCK OF INTEREST
NSString *tempVal = [[NSString alloc] initWithString:value];
[dfm setLastUpdateCheckSum:[NSString stringWithString:tempVal]];
} else if (attr == timeStampAttr) {
[dfm setTimeStamp:value];
}
} else { // more than zero entities
if (numEntities == 1) {
NSArray *fetchedObjects = [[self managedObjectContext] executeFetchRequest:fetchRequest error:&error];
if (attr == checksumAttr) { //BLOCK OF INTEREST
NSString *tempVal = [[NSString alloc] initWithString:value];
[[fetchedObjects objectAtIndex:0] setLastUpdateCheckSum:[NSString stringWithString:tempVal]]; //crashes at this line, after successfully going through the previous BLOCK OF INTEREST area
} else if (attr == timeStampAttr) {
[[fetchedObjects objectAtIndex:0] setTimeStamp:value];
}
} else { // ERROR: more than one entity
//...
}
} // else more than zero entities
[fetchRequest release];
}//setItemInDFMWhilePreservingEntityUniquenessForItem:withValue:
I have marked the areas of interest with //BLOCK OF INTEREST comments and have indicated upon which line the crash occurs (scroll right to see it!). Here is a readout of error from the console:
2011-04-22 17:18:10.924 Parking[26783:207] CoreDataSingleton.m setItemInDFMWhilePreservingEntityUniquenessForItem
2011-04-22 17:18:10.924 Parking[26783:207] -[__NSCFDictionary length]: unrecognized selector sent to instance 0xac34850
2011-04-22 17:18:10.970 Parking[26783:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary length]: unrecognized selector sent to instance 0xac34850'
*** Call stack at first throw:
(
0 CoreFoundation 0x011a0be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x012f55c2 objc_exception_throw + 47
2 CoreFoundation 0x011a26fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01112366 ___forwarding___ + 966
4 CoreFoundation 0x01111f22 _CF_forwarding_prep_0 + 50
5 Foundation 0x00c4d1e1 -[NSPlaceholderString initWithString:] + 162
6 Foundation 0x00c562c2 +[NSString stringWithString:] + 72
7 Parking 0x0000e4d4 -[CoreDataSingleton setItemInDFMWhilePreservingEntityUniquenessForItem:withValue:] + 774
8 Parking 0x00008bb4 -[DataUpdater allDataRetrievedWithSuccess:withError:] + 225
9 Parking 0x0000952e -[DataUpdater dataDownloadCompleted:forFunc:withData:withError:] + 769
10 Parking 0x00010bb5 -[DataRetriever finish] + 432
11 Parking 0x00010e75 -[DataRetriever connectionDidFinishLoading:] + 36
12 Foundation 0x00c61172 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
13 Foundation 0x00c610cb _NSURLConnectionDidFinishLoading + 133
14 CFNetwork 0x0348e606 _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 220
15 CFNetwork 0x03559821 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 293
16 CFNetwork 0x03559b0f _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1043
17 CFNetwork 0x03484e3c _ZN19URLConnectionClient13processEventsEv + 100
18 CFNetwork 0x03484cb7 _ZN17MultiplexerSource7performEv + 251
19 CoreFoundation 0x0118201f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
20 CoreFoundation 0x010e019d __CFRunLoopDoSources0 + 333
21 CoreFoundation 0x010df786 __CFRunLoopRun + 470
22 CoreFoundation 0x010df240 CFRunLoopRunSpecific + 208
23 CoreFoundation 0x010df161 CFRunLoopRunInMode + 97
24 GraphicsServices 0x01414268 GSEventRunModal + 217
25 GraphicsServices 0x0141432d GSEventRun + 115
26 UIKit 0x0004e42e UIApplicationMain + 1160
27 Parking 0x00002698 main + 102
28 Parking 0x00002629 start + 53
)
terminate called after throwing an instance of 'NSException'
I believe it has something to do with copying the string adequately (can't set a string I don't own to the store). I have tried placing [value copy] as well as &value(saw this sort of thing work for someone else, so I thought I would give it a shot) to no avail. Shouldn't my current method adequately take ownership of the string? I still can't figure out what I am doing wrong. Any help appreciated. Thanks!
Best guess (based in part on this answer) is that you're passing in a released object as the value when you call the method the second time, or possibly that value is of class NSDictionary on your second time through – it's not clear from this code snippet why your method takes an argument of type id and then blithely treats it as an instance of NSString, but this may be part of the problem.
Note that your -setItemInDFMWhilePreservingEntityUniquenessForItem:withValue: accepts an arbitrary object in its second argument (type id).
Inside the method, you do:
NSString *tempVal = [[NSString alloc] initWithString:value];
Unless value is an Objective-C string, this will crash your program. In fact, your crash log shows that in that particular execution value was an NSDictionary. You need to make sure that value is an NSString.
Also, note that you own the string you’re assigning to tempVal since you’ve used +alloc. Don’t forget to release that string.

simple problem with a objective c lessons

I am learning objective c for iphone and running into some small error:
Console output:
kill
quit
The Debugger has exited with status 0.
[Session started at 2011-04-26 17:51:40 -0700.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1510) (Wed Sep 22 02:45:02 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
Loading program into debugger…
Program loaded.
run
[Switching to process 13334]
2011-04-26 17:51:40.788 RandomPossessions[13334:a0f] Two
2011-04-26 17:51:40.792 RandomPossessions[13334:a0f] Three
2011-04-26 17:51:40.793 RandomPossessions[13334:a0f] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (4) beyond bounds (4)'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff81d007b4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff856730f3 objc_exception_throw + 45
2 CoreFoundation 0x00007fff81d005d7 +[NSException raise:format:arguments:] + 103
3 CoreFoundation 0x00007fff81d00564 +[NSException raise:format:] + 148
4 Foundation 0x00007fff88ef6aa0 _NSArrayRaiseBoundException + 122
5 Foundation 0x00007fff88e59bc5 -[NSCFArray objectAtIndex:] + 75
6 RandomPossessions 0x0000000100000e8d main + 301
7 RandomPossessions 0x0000000100000d58 start + 52
8 ??? 0x0000000000000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Running…
Program received signal: “SIGABRT”.
sharedlibrary apply-load-rules all
(gdb)
My code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSMutableArray *items = [[NSMutableArray alloc] init];
[items addObject:#"One"];
[items addObject:#"Two"];
[items addObject:#"Three"];
[items insertObject:#"Zero" atIndex:0];
for(int i=0 <[items count];i++;)
{
NSLog(#"%#", [items objectAtIndex:i]);
}
[pool drain];
return 0;
}
I think the program should output zero, one, two, three.
What Is happening here?
You wrote:
for(int i=0 <[items count];i++;)
Was that a typo? It should be:
for(int i=0; i<[items count]; i++)
for (NSString item in items) {
NSLog(#"%#", item);
}

how do I catch a NSRangeException?

I want my app to continue gracefully when the online server messes up. I tried to wrap the dangerous line in a #try block. Yet it is still crashing like so:
the method:
+ (NSArray *)findAllFor:(NSObject *)ratable {
NSString *ratingsPath = [NSString stringWithFormat:#"%#%#/%#/%#%#",
[self getRemoteSite],
[ratable getRemoteCollectionName],
[ratable getRemoteId],
[self getRemoteCollectionName],
[self getRemoteProtocolExtension]];
Response *res = [ORConnection get:ratingsPath withUser:[[self class] getRemoteUser]
andPassword:[[self class] getRemotePassword]];
NSArray *ratings;
#try {
ratings = [self fromXMLData:res.body];
}
#catch (NSException *e) {
ratings = [NSArray array];
}
return ratings;
}
the stack trace:
Program received signal: “SIGABRT”.
2010-08-07 16:38:51.846 TalkToHer[68608:7003] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSArray objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** Call stack at first throw:
(
0 CoreFoundation 0x02932919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02a805de objc_exception_throw + 47
2 CoreFoundation 0x0292858c -[__NSArrayI objectAtIndex:] + 236
3 TalkToHer 0x00009fa7 -[FromXMLElementDelegate parser:didEndElement:namespaceURI:qualifiedName:] + 425
4 Foundation 0x0017bcc1 _endElementNs + 453
5 libxml2.2.dylib 0x02d9deb6 xmlParseXMLDecl + 1353
6 libxml2.2.dylib 0x02da8bc1 xmlParseChunk + 3985
7 Foundation 0x0017b4c2 -[NSXMLParser parse] + 321
8 TalkToHer 0x0000b14d +[NSObject(XMLSerializableSupport) fromXMLData:] + 201
9 TalkToHer 0x00031a6c +[Rating findAllFor:] + 320
10 TalkToHer 0x00032d67 -[FirstClassContentPiece(Ratable) updateRatings] + 96
11 TalkToHer 0x00004d5f __-[InspirationController tableView:didSelectRowAtIndexPath:]_block_invoke_3 + 33
12 libSystem.B.dylib 0x9792efe4 _dispatch_call_block_and_release + 16
13 libSystem.B.dylib 0x97921a4c _dispatch_queue_drain + 249
14 libSystem.B.dylib 0x979214a8 _dispatch_queue_invoke + 50
15 libSystem.B.dylib 0x979212be _dispatch_worker_thread2 + 240
16 libSystem.B.dylib 0x97920d41 _pthread_wqthread + 390
17 libSystem.B.dylib 0x97920b86 start_wqthread + 30
)
terminate called after throwing an instance of 'NSException'
Is my syntax for #try #catch wrong? I attempted to add a #catch block for NSRangeException but it seems that's not the right approach (it's not a class).
Also, the server error is caused by [ratable getRemoteId] sometimes returning (null) instead of an integer. This behavior seems pretty unpredictable; if anyone has a clue why ObjectiveResource might be doing that it would be helpful. But I still would like to know how to use #try #catch.
As I now understand it, throwing exceptions should only be done to alert users of your library that they have made a programming error. I am still curious why the syntax I used did not prevent the crash. I know the error was occurring several levels down; but the #try {} #catch {} block should handle all methods called by the methods I call...
At any rate, here is the fixed code, for anyone who wants to fetch scoped objects from a Rails-style restful resource.
+ (NSArray *)findAllFor:(NSObject *)ratable {
NSString *ratingsPath = [NSString stringWithFormat:#"%#%#/%#/%#%#",
[self getRemoteSite],
[ratable getRemoteCollectionName],
[ratable getRemoteId],
[self getRemoteCollectionName],
[self getRemoteProtocolExtension]];
Response *res = [ORConnection get:ratingsPath withUser:[[self class] getRemoteUser]
andPassword:[[self class] getRemotePassword]];
NSError **aError;
if([res isError]) {
*aError = res.error;
return nil;
}
else {
return [self performSelector:[self getRemoteParseDataMethod] withObject:res.body];
}
}
You don't. You fix your code to not throw an exception under these circumstances.