mamcx
(mamcx)
March 22, 2012, 8:46pm
1
I have this method:
[[BestSellerCloud server].srvData beginPhoto_download_list:[NSDate dateFromISOString:@“2000-01-01”] startWithBlock:^(ROAsyncRequest *r)
{
NSString *fileList = [[BestSellerCloud server].srvData endPhoto_download_list:r];
ALog(fileList);
}];
Now, the DA server is not connected at all. I execute this and don’t get errors or exceptions… How catch it when using blocks?
alexk
(alexk)
March 24, 2012, 5:57am
2
Hi,
There are two ways to catch exceptions for asynchronous requests
a) using
-asyncRequest:didFailWithException:
method of the ROAsyncRequestDelegate protocol.
For example:
-(void)doWork {
ROAsyncRequest *ar = [myService beginDoWithSomething:something start:NO];
[ar setDelegate:self];
[ar startWithBlock:^(ROAsyncRequest *r){
//My block
}];
}
(void) asyncRequest:(ROAsyncRequest *)request
didFailWithException:(NSException *)exception {
…
NSLog(@"%@", exception);
}
b) using failureBlock for the request.
For example
-(void)doWork {
ROAsyncRequest *ar = [myService beginDoWithSomething:something start:NO];
[ar setFailureBlock:^(NSException *exception){
...
NSLog(@"%@", exception);
}];
[ar startWithBlock:^(ROAsyncRequest *r){
//My block
}];
}
Also, more detailed info about handling async requests you can find here:
http://wiki.remobjects.com/wiki/Asynchronous_Calls_in_RemObjects_SDK_(Xcode_(Mac))
http://wiki.remobjects.com/wiki/WIP:Asynchronous_Requests_in_Data_Abstract_(Xcode)
deksden
(deksden)
March 25, 2012, 1:37pm
3
Please notice, that forum engine parser cut links mentioned above! Use full links via copy and paste in browser. And, IMHO, if you use such kind of links in wiki, this is a reason to fix forum engine parser!)