Develop

[2014-12-09 13:11:00 EEvL] Pull Request current develop branch into master.
Choice for sync vs async was two fold. The instructions didn’t mention queueing/threading/async , nor UI for progression indication. As well, The app’s flow can’t continue without a list of items to choose from.

I do understand that UI responsiveness is paramount and if given the requirement for UI responsiveness/threading/queueing or given direction to have progression indication for  query results, I would have made the whole WebServiceManager have it’s own NSOpertationQueue or dispatch_queue_t. and every Instance method would have as a parameter a completion block instead of a return value and would spin off onto the queue using the completion block for returning success/fail and return value/nil.

 

> On Dec 10, 2014, at 5:31 AM, arctouch-caiofonseca <notifications@github.com> wrote:
> 
> In ArcTouchCodeChallenge/ArcTouchCodeChallenge/Sources/Managers/WebServiceManager.m <https://github.com/hockeygod/ArcTouchCodeChallenge/pull/1#discussion-diff-21602749>:
> 
> > +    NSMutableURLRequest *allRoutesRequest = [NSMutableURLRequest requestWithURL:requestURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:30.0];
> > +    
> > +    if (allRoutesRequest != nil)
> > +    {
> > +        allRoutesRequest.HTTPMethod = @"POST";
> > +        [allRoutesRequest addValue:@"Basic V0tENE43WU1BMXVpTThWOkR0ZFR0ek1MUWxBMGhrMkMxWWk1cEx5VklsQVE2OA==" forHTTPHeaderField:@"Authorization"];
> > +        [allRoutesRequest addValue:@"staging" forHTTPHeaderField:@"X-AppGlu-Environment"];
> > +        [allRoutesRequest addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
> > +        
> > +        allRoutesRequest.HTTPBody = requestHTTPBody;
> > +        
> > +        if ([NSURLConnection canHandleRequest:allRoutesRequest])
> > +        {
> > +            NSURLResponse *webServiceResponse;
> > +            NSError *webServiceResponseError;
> > +            NSData *webServiceResponseData = [NSURLConnection sendSynchronousRequest:allRoutesRequest returningResponse:&webServiceResponse error:&webServiceResponseError];
> Why are you making it synchronously? It's blocking the main thread, and as a consequence the UI. If the request takes too long, the app is basically unusable. You should make it asynchronously.
> 
> —
> Reply to this email directly or view it on GitHub <https://github.com/hockeygod/ArcTouchCodeChallenge/pull/1/files#r21602749>.
>