title: How do you create Login page via URL request in Objective C in Xcode?
body: <p>I am making an attempt to create a login after doing some research, but my following code doesn't seem to legitimately have a user signed and keep track of his information once he logs in and keep the user logged in until logged out. </p>
  
  <p>If anyone can verify if it's properly implemented as a login page should and provide some guidance as to how to properly create a login page with my code, I would greatly appreciate it. </p>
  
  <p>Once a user enters in a username (emailTF) and a password (passwordTF) in the textfields and click the sign in button, it triggers the following action:</p>
  
  <pre><code>- (IBAction)signIn:(id)sender {
  
  [self sendSignIn:nil success:^(NSArray  * response) {
      NSLog(@"-----------------------------SIGN UP SUCCESS--------------------------");
  
  } failure:^(NSError * error) {
             NSLog(@"************************************Error*********************************");
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please confirm your username/or password" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
      [alert show];
  }];
  }
  </code></pre>
  
  <p>Once it is successful, it calls the method 'sendSignIn':</p>
  
  <pre><code>-(void)sendSignIn:(NSDictionary *)params success:(Success)success failure:(Error)failure
  
  //If email or password textfield is empty, throw up an error sign
  {if([_emailTF.text isEqualToString:@""]|| [_passwordTF.text isEqualToString:@""])
  {
      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please input your email or password first" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
      [alert show];
  }
  else
  {
      NSString *email = self.emailTF.text;
      NSString *password = self.passwordTF.text;
      NSString *deviceType = @"ios";
      NSString *channelID = [UAirship push].channelID;
  
      NSDictionary *dict = @{@"email": email, @"password": password, @"deviceType": deviceType, @"channelID": channelID};
  
  //Request to url for example: #define SERVER_URL                          @"http://exampleurl.com"
  #define COURSES                             @"/login"
  
      NSString * url = [SERVER_URL stringByAppendingString:COURSES];
      NSLog(@"REQUEST : %@",url);
  
      [self.manager POST:url parameters:dict progress:^(NSProgress * _Nonnull downloadProgress) {
  
          //Upon success, login the user and segue to home page via 'login' segue
      } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
          [self performSegueWithIdentifier:@"login" sender:self];
          success(responseObject);
  
  //Upon failure, throw up a failure sign
          } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
              failure(error);
  
          }];
      }
  }
  </code></pre>
  
  <p>EDIT (How new user is stored - Sign up page):</p>
  
  <pre><code>-(AFHTTPSessionManager *)manager{
  
      if(!_manager){
  
          _manager = [AFHTTPSessionManager manager];
      }
      return _manager;
  }
  
  - (void)sendSignUp:(NSDictionary *)params success:(Success)success failure:(Error)failure
  {
      NSString *firstName = self.firstName.text;
      NSString *lastName = self.lastName.text;
      NSString *email = self.emailTF.text;
      NSString *password = self.passwordTF.text;
      BOOL isProfessor = NO;
  
      NSString * url = [SERVER_URL stringByAppendingString:COURSES];
      NSLog(@"REQUEST : %@",url);
  
      NSDictionary *dict = @{@"firstName":firstName,@"lastName":lastName, @"email": email, @"password": password, @"isProfessor": [NSNumber numberWithBool:NO]};
      //NSDictionary *dict = @{@"student": @1,@"course":@1, @"section": @1, @"quiz": @1, @"question": @1, @"answer": @1};
  
      [self.manager POST:url parameters:dict progress:^(NSProgress * _Nonnull downloadProgress) {
  
  
      } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
  
          success(responseObject);
  
      } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
  
          failure(error);
  
      }];
  
  }
  </code></pre>