Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your webservice class probably hits the web asynchronously, allowing the calling thread to directly continue executing its statements. The direct (but not so nice) solution would be to not have that webservice class call net-functions asynchronously, but then your calling method would hang which is probably not what you want.</p> <p>Your webservice class probably registers itself as the delegate of a connection class. I'd make a protocol WebserviceDelegate, in which you define some methods that get called on the caller of the webservice, something like this:</p> <pre><code>@protocol WebserviceDelegate - (void)webserviceCallFinished; @end </code></pre> <p>Your Webservice class would then have a delegate property:</p> <pre><code>@interface Webservice { id&lt;WebserviceDelegate&gt; delegate; // other ivars } @property (assign) id&lt;WebserviceDelegate&gt; delegate; // other methods @end </code></pre> <p>Then I'd register the calling class (Class A) as the Webservice instance's (ws) delegate (ws.delegate = self). After that call the webservice ([ws callWebservice]). After that, show a spinning animation or something, but right after that, the viewDidLoad method is done.</p> <p>Then, I'd have those connection:didReceiveResponse:resonse, connection:didReceiveData:data, and connectionDidFinishLoading: delegate methods call methods on the webservice delegate.</p> <p>So, your calling class would look like:</p> <pre><code>- (void)viewDidLoad { Webservice *ws = [[Webservice alloc] init]; ws.delegate = self; [ws callWebservice]; [ws release]; } - (void)webserviceCallFinished { // Statement 1 // Statement 2 } </code></pre> <p>While your Webservice class would call the delegate.webserviceCallFinished method when approprate</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload