Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AFNetworking - Why does the asynchronous XML operation not fire and the loop runs infinitely?
- - (void)fetchActiveUser:(NSString*)username withPassword:(NSString *)password {
- [self setAuthorizationHeaderWithUsername:username password:password];
- // SETS FLAG that we are performing a request
- fetchModeActive = TRUE;
- [self getPath:kTLActiveUserURI parameters:nil success:^(AFHTTPRequestOperation
- *operation, id responseObject) {
- if ([responseObject isKindOfClass:[NSXMLParser class]]) {
- TLPersonParser *personParser = [[TLPersonParser alloc]
- initWithParser:responseObject];
- [personParser setDelegate: self];
- [personParser parsePeople];
- [personParser release];
- }
- // handle stuff here.
- NSLog(@"Success!");
- fetchModeActive = FALSE;
- [[NSNotificationCenter defaultCenter]
- postNotificationName:kTLFetchedActiveUserNotification object:nil];
- }
- failure:^(__unused AFHTTPRequestOperation *operation, NSError *error) {
- NSLog(@"Failure.");
- fetchModeActive = FALSE;
- [[NSNotificationCenter defaultCenter]
- postNotificationName:kTLFetchedActiveUserNotification object:error];
- }];
- while(self.fetchModeActive) {
- // WHY DOES THIS RUN INFINITELY?
- // Both above Success: & Failure: blocks set fetchModeActive = FALSE
- // when complete
- NSLog(@"fetching....");
- }
- }
Add Comment
Please, Sign In to add comment