Note that there are some explanatory texts on larger screens.

plurals
  1. POWhile switching view on navigation bar, how to quit NSOperationQueue thread safely without EXC_BAD_ACCESS error
    primarykey
    data
    text
    <p>I am using an UITableView to show some string messages, and I use NSOperationQueue to hold an customized NSOperation which fetchs message in background thread. After one message fetched successfully, customized NSOperation will notify the UITableView controller to show it.</p> <p>If I click back button on the navigation bar to switch from the UITableView to other view after all message loaded, every thing is OK. But, if i click the back button while some message still loading, an EXC_BAD_ACCESS is throw. I have checked that the exception happened while customized NSOperation notify UITableView controller with <code>performSelectorOnMainThread</code> method. Sound like the target UITableView controller is not invalid after view switched, but I think Navigation Controller will hold the view controller instance. May I know how to resolve this issue? Thanks.</p> <p>Customized operation is initialized in the UITableView controller with following code:</p> <pre><code>StatusMessageLoadingOperation *operation = [[StatusMessageLoadingOperation alloc] initWithData:person messageArray:cachedStatusMessages target:self action:@selector(didFinishStatusMessages:)]; [operationQueue addOperation:operation]; [operation release]; </code></pre> <p>The customized NSOperation class will update UITableView with following code:</p> <pre><code>- (void)main{ for (int i = 0; i &lt; [[person statusMessages] count]; i++) { [target performSelectorOnMainThread:action withObject:messageArray waitUntilDone:NO]; } } </code></pre>
    singulars
    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.
 

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