AFNetworking 3.0 GET request save into class in iOS
<p>After searching the internet for how to use <strong>AFNetworking 3.0</strong> to save the response object inside a custom class, all that I found is the basic usage of <strong>AFNetworking</strong> library with <code>GET</code> requests such as <a href="https://stackoverflow.com/questions/21974333/get-request-using-afnetworking-and-saving-response">GET request using AFNetworking and saving response</a> and <a href="https://stackoverflow.com/questions/33339795/afnetworking-send-array-in-json-parameters-of-get-request">AFNetworking send array in JSON parameters of GET request</a>.</p>

<h2>Code:</h2>

<pre><code>[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

listOfEventsObjects = [@[] mutableCopy];
self.tableView.delegate = self;


AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

[manager GET:@"http://api.com.getevents.php" parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {


    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    NSArray *h  = [responseObject objectForKey:@"events"];

    NSError *error;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:h options:0 error:&amp;error];
    NSArray *json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&amp;error];


    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

    for (int i  = 0 ; i &lt; [json count]; i++) {
        geeksEvent *h1 = [geeksEvent new];

        //h1.eventId = [];
        //h1.eventId = [[json valueForKey:@"eventId"] intValue];
        //NSLog(@"json data is: %@",h1);

    }

    //  events = [responseObject objectForKey:@"events"];

    if ([responseObject isKindOfClass:[NSArray class]]) {
      //  NSArray *responseArray = responseObject;
        NSLog(@"array");
        /* do something with responseArray */
    } else if ([responseObject isKindOfClass:[NSDictionary class]]) {
        NSLog(@"dictionary");
        NSDictionary *responseDict = responseObject;

      //  NSDictionary *responseDict = responseObject;
        /* do something with responseDict */
    }


//        AFJSONResponseSerializer *responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingAllowFragments];
//
//        responseSerializer = [AFJSONResponseSerializer serializer];
//        responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json; charset=UTF-8", nil];
//    
//       // NSArray *data  = (responseObject *) NSArray;
//        NSError *error;
//        NSData *data   = (NSData *) responseObject;
//       // NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:errno error:&amp;error];
//    
//        
//        NSLog(@"JSon arrays is: %@",data);

        //NSDictionary *jsonDict = (NSDictionary *) responseObject;

//        
//        NSLog(@"%lu",(unsigned long)events.count);
//        
//        for (int i =  0; i  &lt;  [events count]; i ++) {
//            
//            geeksEvent *event  = [events objectAtIndex:i];
//        
//            
//            NSLog(@"event %d is %@",i,event);
//            
//            
//            @try {
//                
//                event.eventId = [[events valueForKey:@"eventId"]intValue];
//                
//                event.eventTitle  = [[events valueForKey:@"eventTitle"] componentsJoinedByString:@""];
//                
//                event.eventShortDiscription = [[event valueForKey:@"eventShortDesc"] componentsJoinedByString:@""];
//                event.eventDescription = [[event valueForKey:@"eventDescription"] componentsJoinedByString:@""];
//                
//                event.eventDate = [events valueForKey:@"eventDate"];
//                event.eventTime = [events valueForKey:@"eventTime"];
//                event.eventUrl = [events valueForKey:@"eventUrl"];
//                
//                [listOfEventsObjects addObject:event];
//                
//            } @catch (NSException *exception) {
//                
//                NSLog(@"%@",exception);
//                
//            } @finally {
//                
//            }
//            
//        }


        [self.tableView reloadData];
</code></pre>

<p>I cannot figure out how to save the response object into custom class.</p>

<h2>geeksEvent ## custom class:</h2>

<h2>.h</h2>

<pre><code>#import &lt;Foundation/Foundation.h&gt;

@interface GeeksLocations : NSObject
@property (nonatomic) int geeksBranchId;
@property(nonatomic) double *geeksLongtitude;
@property (nonatomic) double *geeksLatitude;
@property (nonatomic,strong) NSString *geeksAddress;
@property (nonatomic,strong) NSString *geeksMobile;
@property (nonatomic,strong) NSString *geeksTel;
@property (nonatomic,strong) NSString *geeksOpenDays;
@property (nonatomic,strong) NSDate *geeksOpenTime;

@end
</code></pre>

<h2>.m</h2>

<pre><code>#import "GeeksLocations.h"

@implementation GeeksLocations
@synthesize geeksBranchId;
@synthesize geeksLongtitude;
@synthesize geeksLatitude;
@synthesize geeksMobile;
@synthesize geeksTel;
@synthesize geeksAddress;
@synthesize geeksOpenDays;
@synthesize geeksOpenTime;
@end
</code></pre>

<h2>Response</h2>

<blockquote>
  <p>{"success":1,"events":[{"eventId":"1","eventTitle":"Open Wings Tuesday","eventShortDesc":"we are offering open wings all the day","eventDiscription":null,"eventDate":"2016-05-22","eventTime":"12:49:00","eventUrl":"http://www.code-bee.net/geeks/images/cover-7.jpg"},{"eventId":"2","eventTitle":"Testing","eventShortDesc":"Testing","eventDiscription":null,"eventDate":"2016-05-22","eventTime":"12:49:00","eventUrl":"http://www.code-bee.net/geeks/images/cover-8.jpg"}]</p>
</blockquote>