Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it's better to create a protocol:</p> <pre><code>@protocol MONStuffParserRecipientProtocol @required - (void)parsedStuffIsReady:(NSDictionary *)parsedStuff; @end </code></pre> <p>and to declare the view controller:</p> <pre><code>@class MONStuffDownloadAndParserOperation; @interface MONViewController : UIViewController &lt; MONStuffParserRecipientProtocol &gt; { MONStuffDownloadAndParserOperation * operation; // add property } ... - (void)parsedStuffIsReady:(NSDictionary *)parsedStuff; // implement protocol @end </code></pre> <p>and add some backend: to the view controller</p> <pre><code>- (void)displayDataAtURL:(NSURL *)url { MONStuffDownloadAndParserOperation * op = self.operation; if (op) { [op cancel]; } [self putUpLoadingIndicator]; MONStuffDownloadAndParserOperation * next = [[MONStuffDownloadAndParserOperation alloc] initWithURL:url recipient:viewController]; self.operation = next; [next release], next = 0; } </code></pre> <p>and have the operation hold on to the view controller:</p> <pre><code>@interface MONStuffDownloadAndParserOperation : NSOperation { NSObject&lt;MONStuffParserRecipientProtocol&gt;* recipient; // &lt;&lt; retained } - (id)initWithURL:(NSURL *)url Recipient:(NSObject&lt;MONStuffParserRecipientProtocol&gt;*)recipient; @end </code></pre> <p>and have the operation message the recipient when the data is downloaded and parsed:</p> <pre><code>// you may want to message from the main thread, if there are ui updates [recipient parsedStuffIsReady:parsedStuff]; </code></pre> <p>there are a few more things to implement -- it's just a form. it's safer and involves direct messaging, ref counting, cancellation, and such.</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. This table or related slice is empty.
    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