What i need is to login first using this function and than i'd like to e.g. call a function that show's the orders, depending on the user_id stored during the login in the $_SESSION variable on the Server using php.
Can anybody help me get this set? The login works flawlessly, but it seems like AFNetworking drops the session and doesn't persist it.
Thanks in advance.
NSURL *baseURL = [NSURL URLWithString:@"https://example.com/robot/"]; NSDictionary *parameters = @{@"eMail": eMail.text, @"pass" : password.text };
NSURLSessionConfiguration *sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:sessionConfiguration];
[manager initWithBaseURL:baseURL];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager POST:@"iPad.php?action=Login" parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) {
NSDictionary *json = responseObject;
NSString *jsonstatus;
jsonstatus = [json objectForKey:@"status"];
if ([jsonstatus isEqualToString:@"100"]){
NSLog(@"logged in");
}
NSURL *baseURL = [NSURL URLWithString:@"https://example.com/robot/"]; NSDictionary *parameters = @{@"query": @"" };
NSURLSessionConfiguration *sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:sessionConfiguration];
[manager initWithBaseURL:baseURL];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager POST:@"iPad.php?action=ShowOrders" parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) {
NSLog(@"hi");
NSDictionary *json = responseObject;
NSString *jsonstatus;
jsonstatus = [json objectForKey:@"status"];