iOS - in a view controller, where is the most logical place to put user-session management code?
===

I am an iOS newbie and I am trying to understand some of the "good practice" ways of doing things in an iOS app.

I have a ViewController which I made to be the controller that is called when the app starts.  In it I saw a function called viewDidLoad and I tried to modify it to check if the user has had a user_id and then call a function that would eventually make an asynchronous request to manage that user in a remote db.  Here is my code:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        
        EmailUtil *email = [EmailUtil alloc];
        email = [email init];
    
        // This is just a test call to the function that would make a remote server request
        [email setEmail: @"test" andBody: @"hello"];
       
    
        NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
        if([standardUserDefaults objectForKey:@"user_id"] == nil)
        {
            NSLog(@"First time"); 
    
            [standardUserDefaults setBool:YES forKey:@"user_id"];      
            
        }
        else 
        {
            NSString *subject = @"subject";
            NSString *body = @"bod";
           
             NSLog(@"Not first time"); 
        }    
    }

So there are a few things I am unsure with here. Can the fact that I am calling a function to make a remote call from viewDidLoad cause problems in that function? Currently its not sending the remote request.

Also, should I deallocate memory for the objects I create right at the end of this function? 

Or should I just move this code to another spot in the class where it would make more sense to have that code there?

Thank you!