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 8678387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:42:28+00:00 2026-06-12T20:42:28+00:00

As a newbie in iOS development (and programming), I am trying to accomplish something

  • 0

As a newbie in iOS development (and programming), I am trying to accomplish something that I think is simple – but I need some help writing the code.

I have a mutable array that contains some facebook objects. The array is called facebookPhotosAllTemporary. I want to iterate through the array, pull out each object (a UIImage) at each index, and insert each of those images into a new array called facebookPhotosAll. Here is the code that I currently have:

In the implementation I have a private method:

- (void) addImagestoArray {
int i;
for (i = 0; i < [facebookPhotosAllTemporary count]; i++) {
    UIImage *image = [UIImage imageWithData:
                           [NSData dataWithContentsOfURL:
                            [NSURL URLWithString:
                             [[facebookPhotosAllTemporary objectAtIndex:i]
                              objectForKey:@"pic_big"]]]];
    [facebookPhotosAll addObject:image];
           }
}

Then in the viewDidLoad section I call the method:

[self addImagestoArray];

When I run it, my NSLog message says there are no objects in the array I am trying to add objects to.

I realize my code could be completely flawed! But could someone put me on the right track? Thanks!

  • 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-12T20:42:29+00:00Added an answer on June 12, 2026 at 8:42 pm

    There are a few issues here.

    1. Did you allocate and initialize facebookPhotosAll? In other words, somewhere, such as in your init method or in viewDidLoad, did you do something like:

      facebookPhotosAll = [[NSMutableArray alloc] init];

    2. You are loading a set of images from the Internet synchronously on the main thread of your app. This will hang the user interface. Best case is this will make your app look frozen briefly. Worst case the OS will kill your app for failing to respond if this takes too long.

    3. The line you wrote to get the image is nasty, hard to read, and difficult to debug. Split that into 5 lines. This way you can see each part in case there are issues.

    To deal with issue 2 you should refer to the LazyTableImages sample app that Apple provides. This shows the proper way to load images in the background. Never do synchronous Internet access on the main thread.

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

Sidebar

Related Questions

I am a complete newbie to iOS development but not to programming. I am
I am an iOS development newbie. I am implementing some sample code, but try
I am a newbie in iOS application development, but I am trying to learn
I am newbie for iOS programming. I'm trying to create an array of arrays
This may sound a newbie question ... but however I'm new to iOS development.
I am currently a newbie to iOS development and trying to get the cache
I'm newbie in iOS development and I have a question. I have a some
I am a newbie to iOS development. I have to develop an app that
I am an iOS development newbie. I am trying to add two switches to
I am an iOS newbie and I am trying to understand some of the

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.