title: retain assigned values from within block in objective-c
body: <p>I'm trying to create an app that implements customized tunnel protocols.
  and having issue with assigning value to variable from block, see following code</p>
  
  <pre><code>@implementation ProfileTableViewController{
       __block NSArray *vpnProfiles;
  }
  
  - (void)viewDidLoad {
      [super viewDidLoad];
      self.tableView.allowsMultipleSelectionDuringEditing = NO;
  [NETunnelProviderManager loadAllFromPreferencesWithCompletionHandler:^(NSArray* newManagers, NSError *error)
       {
           if(error != nil){
               NSLog(@"Load Preferences error: %@", error);
           }else{
  
               if([newManagers count] &gt; 0)
               {
                   vpnProfiles = newManagers;
                   NSLog(@"vpnProfiles 1st: %ld", [vpnProfiles count]);
               }
           }
       }];
  
   NSLog(@"vpnProfiles 2nd: %ld", [vpnProfiles count]);
  }
  </code></pre>
  
  <p>the above will print </p>
  
  <pre><code>vpnProfiles 2nd: 0
  vpnProfiles 1st: 1
  </code></pre>
  
  <p>my understanding is that this issue is due to async threads, but i can't seem to find a solution after searching and trying.</p>
  
  <p>anyone has suggestions on how to get <strong><em>newManagers</em></strong> to local variable <strong><em>vpnProfiles</em></strong>?</p>