Replace asynchronous requests with synchronous requests in background thread in iOS? -
i tried afhttprequestoperation objects combined other nsoperation objects placed queue. know in afhttprequestoperation requests performed in right order (not response processing blocks).
i don't need right order of requests need handle responses in right order , send "success" notification @ end. if 1 of steps failed cancel sequence. thought have following:
nsblockoperation *operation = [nsblockoperation blockoperationwithblock:^{ //synchronous request1 ... //handle request1 response ... //synchronous request2 ... //handle request2 response ... //send notification success or failure ... }]; it looks crazy correct. code correct? advice better?
you're right. basic thing have synchronize responses based on completion. , not matter if utilize sync or async way. scheme: request(sync/async) -> completion -> request 2 (sync/async) -> completion...etc..
ios asynchronous nsoperation nsoperationqueue synchronous
No comments:
Post a Comment