fetching data from twitter api-Collection of common programming errors

I am trying to fetch a twitter feed. I am using this URL

https://twitter.com/status/user_timeline/wwwkrcgenkbe.json?count=25&from=wwwkrcgenkbe

This url gives the following JSON Format

[

    {
        "place": null,
        "retweeted": false,
        "in_reply_to_status_id_str": null,
        "in_reply_to_screen_name": null,
        "possibly_sensitive": false,
        "in_reply_to_status_id": null,
        "truncated": false,
        "in_reply_to_user_id_str": null,
        "user": { . },
        "in_reply_to_user_id": null,
        "contributors": null,
        "coordinates": null,
        "retweet_count": 0,
        "favorited": false,
        "created_at": "Tue Oct 09 08:54:53 +0000 2012",
        "geo": null,
        "source": "Facebook",
        "id_str": "255592155345727489",
        "id": 255592155345727500,
        "possibly_sensitive_editable": true,
        "text": "Vorige week won Nele Vangeneugden het shirtje dat Jelle Vossen droeg in de Europa League wedstrijd tegen... http://t.co/mwxSsBLP"
    },

I am doing it at the following way. First I add this method.

 for (NSDictionary *genkInfo in tweets ) {
            NSLog(@"Komt in deze methode");
            [Twitter twitterWithGenkInfo:genkInfo inManagedObjectContext:document.managedObjectContext];
            NSLog(@"tweets: %@", tweets); 
        }

And then I store the values in my core data database at this way.

  + (Twitter *)twitterWithGenkInfo:(NSDictionary *)genkInfo
                inManagedObjectContext:(NSManagedObjectContext *)context
{
    NSLog(@"till here");
    Twitter *twitter= nil;
    NSLog(@"till here 2");
    twitter = [NSEntityDescription insertNewObjectForEntityForName:@"Twitter"
                                               inManagedObjectContext:context];
    NSLog(@"tille here3");
    twitter.tweet      = [genkInfo objectForKey:TWITTER_TWEET];
    twitter.date       = [genkInfo objectForKey:TWITTER_DATE];
     NSLog(@"till here 4");
    NSLog(@"tweet is: %@",twitter.tweet);
    NSLog(@"date is: %@",twitter.date);

    return twitter;
}

This method is called in my view controller at the following way.

NSArray *tweets         = [GenkData getTweets];

 for (NSDictionary *genkInfo in tweets ) {
                NSLog(@"Komt in deze methode");
                [Twitter twitterWithGenkInfo:genkInfo inManagedObjectContext:document.managedObjectContext];
            }

But I am getting always this error.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull objectForKey:]: unrecognized selector sent to instance 0x2751678'

Can anybody help?

Thanks in advance!

LOG FILE

Log is: (
        {
        contributors = "";
        coordinates = "";
        "created_at" = "Tue Oct 09 12:53:08 +0000 2012";
        favorited = 0;
        geo = "";
        id = 255652115341508608;
        "id_str" = 255652115341508608;
        "in_reply_to_screen_name" = "";
        "in_reply_to_status_id" = "";
        "in_reply_to_status_id_str" = "";
        "in_reply_to_user_id" = "";
        "in_reply_to_user_id_str" = "";
        place = "";
        "possibly_sensitive" = 0;
        "possibly_sensitive_editable" = 1;
        "retweet_count" = 0;
        retweeted = 0;
        source = "Facebook";
        text = "KRC Genk mobile: de Iphone APP (al meer dan 1 mnd beschikbaar) werd reeds 2226 keer gedownload, de Android APP... http://t.co/QidTcLJS";
        truncated = 0;
        user =         {
            "contributors_enabled" = 0;
            "created_at" = "Fri Nov 20 18:57:28 +0000 2009";
            "default_profile" = 0;
            "default_profile_image" = 0;
            description = "The official twitter account from Belgian Soccer team KRC Genk. Belgium champions 2011. Qualified for UEFA Euro League 2012-2013.";
            "favourites_count" = 1;
            "follow_request_sent" = "";
            "followers_count" = 4831;
            following = "";
            "friends_count" = 21;
            "geo_enabled" = 0;
            id = 91402003;
            "id_str" = 91402003;
            "is_translator" = 0;
            lang = en;
            "listed_count" = 94;
            location = "Genk -  Belgium";
            name = "KRC Genk";
            notifications = "";
            "profile_background_color" = C0DEED;
            "profile_background_image_url" = "http://a0.twimg.com/profile_background_images/84123014/youtubebg.jpg";
            "profile_background_image_url_https" = "https://si0.twimg.com/profile_background_images/84123014/youtubebg.jpg";
            "profile_background_tile" = 0;
            "profile_image_url" = "http://a0.twimg.com/profile_images/654317237/twitter_thumb_normal.jpg";
            "profile_image_url_https" = "https://si0.twimg.com/profile_images/654317237/twitter_thumb_normal.jpg";
            "profile_link_color" = 0084B4;
            "profile_sidebar_border_color" = C0DEED;
            "profile_sidebar_fill_color" = DDEEF6;
            "profile_text_color" = 333333;
            "profile_use_background_image" = 1;
            protected = 0;
            "screen_name" = wwwkrcgenkbe;
            "statuses_count" = 4230;
            "time_zone" = "";
            url = "http://www.krcgenk.be";
            "utc_offset" = "";
            verified = 0;
        };
    },
-[__NSCFNumber managedObjectContext]: unrecognized selector sent to instance 0x9331b40
  1. executeGenkFetch seems to be returning you an empty array, or an array of empty dictionaries. As @ilmiacs said, post the output of tweets.

Originally posted 2013-11-16 20:49:30.