Saturday 27 February 2016

how to use AFNetworking Using Post IOS 9 Iphone

NSURL *URL = [NSURL URLWithString:@"http://example.com"];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:URL];
[manager GET:@"/resources" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
    [resources addObjectsFromArray:responseObject[@"resources"]];

    [manager SUBSCRIBE:@"/resources" usingBlock:^(NSArray *operations, NSError *error) {
        for (AFJSONPatchOperation *operation in operations) {
            switch (operation.type) {
                case AFJSONAddOperationType:
                    [resources addObject:operation.value];
                    break;
                default:
                    break;
            }
        }
    } error:nil];
} failure:nil];

=======>

Link of Reference:
http://nshipster.com/afnetworking-2/
===> Class Of AFnetworking:-
https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-2.0-Migration-Guide