NINetworkRequestOperation not available in WHSearchController #3

Closed
rainmaker2k opened this Issue Sep 5, 2012 · 7 comments

Projects

None yet

6 participants

@rainmaker2k

NINetworkRequestOperation doesn't seem to be available anymore in the nimbus library.

@krishnenc

Its been deprecated in favour of AFNetworking it seems.

@JeeLiu
JeeLiu commented Sep 7, 2012

NINetworkRequestOperation *op = [[NINetworkRequestOperation alloc] initWithURL:searchURL]; NINetworkRequestOperation doesn't find

@marcobrambilla

Same issue here...

@tonycelestino

Same issue and I was unable to find any information regarding this in their documentation.

@krishnenc

You can migrate the functions that use NINetworkRequestOperation to use AFNetworking which is the default in Nimbus now:

ex:

    self.page = self.page + 1;
    NSString *formatString = AppConfig(@"SearchURLFormat");
    NSString *escaped = [[self class] escapeQueryParameter:query];
    NSURL *searchURL = [NSURL URLWithString:[NSString stringWithFormat:formatString, escaped, self.page]];
    DebugLog(@"Search URL = %@", searchURL);
    NSURLRequest *request = [NSURLRequest requestWithURL:searchURL];
    AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
        id results = [JSON objectForKey:@"results"];
        if (results && [results respondsToSelector:@selector(objectAtIndex:)]) {
            if (self.results) {
                self.results = [self.results arrayByAddingObjectsFromArray:results];
            } else {
                self.results = results;
            }
            [self.delegate searchControllerDidFindResults:self];
        }

    } failure:^(NSURLRequest *request, NSHTTPURLResponse *response,NSError *error,id JSON) {
        [self reportError:error];
    }];
    [operation start];
@tonycelestino

Thanks @krishnenc , I'll try that later. Someone should send a Pull Request with these changes.

@welschp
Contributor
welschp commented Sep 10, 2012

Thanks, all - this should be addressed. Closing this issue; if the problem continues please let us know

@welschp welschp closed this Sep 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment