Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS - Instance Array not holding data
    primarykey
    data
    text
    <p>For some reason I can't get twitterAccounts to hold another arrays data.</p> <p>ViewController.h</p> <pre><code>@interface ViewController : UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; @property (strong, nonatomic) NSArray *twitterAccounts; @property (strong, nonatomic) IBOutlet UITableView *chooseTwitterAccountTableView; - (void)twitterRequest; @end </code></pre> <p>ViewController.m</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; _twitterAccounts = [[NSArray alloc]init]; [self twitterRequest]; } - (void)twitterRequest { ACAccountStore *account = [[ACAccountStore alloc]init]; ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; [account requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) { if (granted == YES) { NSArray *twitterAccountsTemp = [account accountsWithAccountType:accountType]; _twitterAccounts = twitterAccountsTemp; NSLog(@"Array first has: %lu elements.", [_twitterAccounts count]); } }]; } </code></pre> <p>What I don't understand is if I have my viewDidLoad method like this:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; _twitterAccounts = [[NSArray alloc]init]; [self twitterRequest]; NSLog(@"After method called: %lu", [_twitterAccounts count]); } </code></pre> <p>The output is:</p> <pre><code>After method called 0. Array first has: 1 elements. </code></pre> <p>is it not supposed to be the other way around since I'm calling the method before outputting the amount of elements in the array?</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.
 

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