Closed hejunbinlan closed 5 years ago
Hi @hejunbinlan, in this case, the Promises' value
would be an NSArray
containing an NSData
object and an NSURLResponse
object. Here's an example.
I.e. something like:
- (FBLPromise<NSArray *> *)fetchWithURL:(NSURL *)url {
return [FBLPromise wrap2ObjectsOrErrorCompletion:^(FBLPromise2ObjectsOrErrorCompletion handler) {
[NSURLSession.sharedSession dataTaskWithURL:url completionHandler:handler];
}];
}
// ...
[[object fetchWithURL:...] then:^id(NSArray *result) {
NSData *data = result.firstObject;
NSURLResponse *response = result.lastObject;
//...
}];