I have a bit of an architecture problem. I have a method that returns an array based on data from a server.
NSArray *myStuff = [anObject getMyStuff];
Obviously the server can fail. What is the best way to cater for this? I was looking at how performFetch: works, but that has a BOOL as a return type. Can I have:
NSArray *myStuff = [anObject getMyStuff:&anError];
You should, as e.James suggested before, do a proper asynchronous handling, where the object, that performs the fetch, will call a method, if it was successful or another, if it failed.
There is an variant of this, that is used in the popular AFNetworking: pass two blocks to the method, one for the failing case, one for the success case
This could look like this than: