Frage

So habe ich es geschafft, die Futter von twitter zu bekommen und bin versucht, es zu analysieren ... Ich brauche nur die folgenden Felder aus dem Futter: Name, Beschreibung, time_zone und created_at Ich bin Herausziehen erfolgreich Namen und eine Beschreibung .. aber time_zone und created_at immer Null sind ... Im Folgenden ist der Code ...

Wer sehen, warum diese Macht nicht funktioniert sein?

-(void) friends_timeline_callback:(NSData *)data{

    NSString *string = [[NSString alloc] initWithData:data  encoding:NSASCIIStringEncoding];
    NSLog(@"Data from twitter: %@", string);

    NSMutableArray *res = [[NSMutableArray alloc] init]; 
    CXMLDocument *doc = [[[CXMLDocument alloc] initWithData:data options:0 error:nil] autorelease]; 
    NSArray *nodes = nil; 

    //! searching for item nodes 
    nodes = [doc nodesForXPath:@"/statuses/status/user" error:nil]; 

    for (CXMLElement *node in nodes) 
    { 
        int counter; 
        Contact *contact  = [[Contact alloc] init]; 

        for (counter = 0; counter < [node childCount]; counter++) 
        { 
            //pulling out name and description only for the minute!!!
            if ([[[node childAtIndex:counter] name] isEqual:@"name"]){
                contact.name = [[node childAtIndex:counter] stringValue];

            }else if ([[[node childAtIndex:counter] name] isEqual:@"description"]) {

                // common procedure: dictionary with keys/values from XML node 
                if ([[node childAtIndex:counter] stringValue] == NULL){
                    contact.nextAction = @"No description";
                }else{
                    contact.nextAction = [[node childAtIndex:counter] stringValue];
                }

            }else if ([[[node childAtIndex:counter] name] isEqual:@"created_at"]){

                contact.date == [[node childAtIndex:counter] stringValue];

            }else if([[[node childAtIndex:counter] name] isEqual:@"time_zone"]){

                contact.status == [[node childAtIndex:counter] stringValue];
                [res addObject:contact];
                [contact release];
            }
        } 
    }
    self.contactsArray = res;
    [res release];
    [self.tableView reloadData];

}

Vielen Dank im Voraus für Ihre Hilfe !!

Fiona

War es hilfreich?

Lösung

ein Fehler sein könnte, aber warum sind sie doppelt equals (==), in der Regel für eine Bedingungsprüfung verwendet

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top