Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>More code would be helpful but here are some suggestions:</p> <ol> <li><p>Check if <code>startUploads</code> is being called before the view is loaded. The view will only be loaded when it is accessed for the first time to be added to a superview.</p></li> <li><p>Consider initializing <code>processList</code> in your <code>init</code> method instead of <code>viewDidLoad</code> both to solve #1 and b/c the view can loaded &amp; unloaded by iOS independently of the lifecycle of the viewController (depending on what other views you are displaying and whether any memory warnings occur).</p></li> <li><p>Make sure you are releasing <code>processList</code> in <code>dealloc</code>. You only need to release it in <code>viewDidUnload</code> if it is recreated and loaded in <code>viewDidLoad</code>.</p></li> </ol> <p>Your code sample doesn't show when <code>startUploads</code> is being called and you aren't adding any items to <code>processList</code> so it's hard to tell if the above is relevant. Post some more code and I'll revise my answer accordingly.</p> <p>good luck!</p> <p>[EDIT: added example code]</p> <p>The code fragments you posted are not a complete implementation of a view controller and the associated objects that interact with it. Given the code I have seen, your application design does not conform to MVC (Model/View/Controller) design pattern and I would be doing things a bit differently. However, I don't want to make assumptions about code I haven't seen or your ultimate intent or ability as a developer. I can't write your app for you, just trying to directly help you with the specific question you asked regarding why your NSMutableArray property remains null after the <code>startUploads</code> action completed. With that in mind, here are my edits to the code you posted:</p> <p>processViewController.m - add the following:</p> <pre><code>- (id)initWithNibNamed:(NSString *)nibName bundle:(NSBundle *)bundle { self = [super initWithNibNamed:nibName bundle:bundle]; if (self) { processList = [[NSMutableArray alloc] init]; } return self; } - (void)dealloc { self.processList = nil; [super dealloc]; } </code></pre> <p>different.m</p> <pre><code>- (void)displayProcessVC { ProcessViewController *processVC = [[ProcessViewController alloc] initWithNibNamed:@"processView.xib" bundle:nil]; NSLog(@"Different:displayProcessVC BEFORE STARTING UPLOAD, processList = %@", processVC.processList); [processVC startUploads]; NSLog(@"Different:displayProcessVC AFTER STARTING UPLOAD, processList = %@", processVC.processList); // would normally present process VC here [processVC release]; } </code></pre> <p>Hope this helps.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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