Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8344687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:27:02+00:00 2026-06-09T06:27:02+00:00

I’m working on a Facebook Feed App for the iPhone that, among other things,

  • 0

I’m working on a Facebook Feed App for the iPhone that, among other things, determines if a picture is attached to a post, and stores it in an array. When I run the code, my NSLogs tell me that nothing is being put into the array, even though it’s reading whether or not there is an objectAtKey:@”picture”. The following is some of my code.

from MasterView.m:

//create array containing individual "datas"
NSArray *items = [json objectForKey:@"data"];

for(NSDictionary *item in items)
{
    // store message in ItemStore sharedStore
    if([item objectForKey:@"message"] || [item objectForKey:@"message"] != nil || 
       [[item objectForKey:@"message"] length] > 0){
        [[JSONFeedItemStore sharedStore] createItem:[item objectForKey:@"message"]];
    }

    // 
    if([item objectForKey:@"picture"]){
        [[JSONFeedItemStore sharedStore] createPicture:[[item objectForKey:@"picture"] description]];
        NSLog(@"url: %@", [item objectForKey:@"picture"]);
    } else {
        [[JSONFeedItemStore sharedStore] createPicture:@"http://i.imgur.com/TpIK5.png"]; // blank
        NSLog(@"creating blank picture");
    }
}

from ItemStore.m

- (void)createPicture:(NSString *)pictureUrl
{
    [pictures addObject:pictureUrl];
    NSLog(@"Number: %d, URL: %@", [pictures count], [pictures objectAtIndex:[pictures count]]);
}

and my console

2012-08-07 08:21:54.153 JSONFeed[2502:f803] Number: 0, URL: (null)
2012-08-07 08:21:54.154 JSONFeed[2502:f803] creating blank picture
2012-08-07 08:21:54.155 JSONFeed[2502:f803] Number: 0, URL: (null)
2012-08-07 08:21:54.156 JSONFeed[2502:f803] creating blank picture
2012-08-07 08:21:54.157 JSONFeed[2502:f803] Number: 0, URL: (null)
2012-08-07 08:21:54.157 JSONFeed[2502:f803] url: http://photos-a.ak.fbcdn.net/hphotos-ak-ash4/423482_427478620624383_82270372_s.jpg
2012-08-07 08:21:54.158 JSONFeed[2502:f803] Number: 0, URL: (null)
2012-08-07 08:21:54.158 JSONFeed[2502:f803] creating blank picture

SharedStore is a part of an ItemStore class created to store the messages and pictures from Facebook posts. If you have any questions, or need to see more code, feel free to ask. I’m also taking any suggestions for improvements, as I am still new to programming Apps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:27:04+00:00Added an answer on June 9, 2026 at 6:27 am

    One possibility is that pictures is nil. You can’t add objects to an array if the array doesn’t exist, and it’s legal to send messages to nil. The result you get back will also be nil or zero, so your call to -objectAtIndex: logs “(null)”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.