Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6669239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:07:36+00:00 2026-05-26T03:07:36+00:00

I know that the pattern in iPhone is to use ASync connection calls (using

  • 0

I know that the pattern in iPhone is to use ASync connection calls (using the informal protocols that is implemented by the current class).

In my case, I’ve created a utility class to do the networking staff and then return the data to the ViewController.

I find is inadequate to implement the connection model as Async in a utility class because r I will write a block of code in the ViewControlle such following: (which IMHO is bad)

MyUtilityConnection* utilConn = ....
while (true)
{
    if ([utilConn checkUnderlyingAsyncConnectionFinishedLoading]) break;
}
NSData* dataFromUrl = [utilConn dataFromUnderlayingConn];

So, the question is, Does using Sync connection model in iPhone could causes problem? and solutions?

(What about the drawing will stril hanging until the data come???)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:07:37+00:00Added an answer on May 26, 2026 at 3:07 am

    AVOID by all means to do synchronous connections! This will obviously freeze your UI (and it gets worse if you don’t have a good bandwidth of course).

    What you could do is to use the blocks syntax to write more readable code when you need to download data. Create a class that implements the NSURLConnection delegate methods, and then call the block when the data is done.


    See my OHURLLoader class on github for example that does exactly that (and that’s only one solution).

    Usage example:

    NSURL* url = ...
    NSURLRequest* req = [NSURLRequest requestWithURL:url];
    
    OHURLLoader* loader = [OHURLLoader URLLoaderWithRequest:req];
    [loader startRequestWithCompletion:^(NSData* receivedData, NSInteger httpStatusCode) {
        NSLog(@"Download of %@ done (statusCode:%d)",url,statusCode);
        outputTextView.text = loader.receivedString;
    } errorHandler:^(NSError *error) {
        NSLog(@"Error while downloading %@: %@",url,error);
        outputTextView.text = [error localizedDescription];
    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i know that in Java you can use their built-in APIs for design pattern.
I know that logging is a prime use case for AOP. Additionally logging wrappers
I'm wondering what is the markup pattern of DRUPAL. I know that the site
I know that Singleton pattern is bad because it uses global state. But in
I know that everything we do in programming can be described as design pattern(even
It's regarding Abstract Factory pattern. As we know that there are 2 ways we
In the iPhone objective-c world, I've seen this pattern everywhere and I use it
Does the state pattern in an iPhone application -- In my case, a relatively
I'm developing an app for iPhone 3.1.3. I have the following class: @interface Pattern
Recently I have come across a curious pattern in some code. We know that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.