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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:28:23+00:00 2026-05-24T14:28:23+00:00

NSUInteger index, count = [delegate.thumbArr count]; for (index = 0; index < count; index++)

  • 0
  NSUInteger index, count = [delegate.thumbArr count];
  for (index = 0; index < count; index++) 
  {

     NSString *tPath = [[NSString alloc] init];
     tPath = [delegate.thumbArr objectAtIndex:index];
     NSURL *turl = [NSURL URLWithString:tPath];

     UIImage *_thumb =[self getImage:turl];

     // Adding images to the NSMutableArray TViews
     [TViews addObject:_thumb];

     UIImage *_thumb2 =[TViews objectAtIndex:index];
     NSLog(@"Our Image is= %@", _thumb2 );

     [thumbView.imageView setImage:_thumb2];


  }

- (UIImage*)getImage:(NSURL*)myurl
{


    SDWebImageManager *manager = [SDWebImageManager sharedManager];
    UIImage *cachedImage = [manager imageWithURL:myurl];

    if(!cachedImage)
    {
        [manager downloadWithURL:myurl delegate:self];
    }

   else
    return cachedImage;

}

- (void)webImageManager:(SDWebImageManager *)imageManager didFinishWithImage:(UIImage *)image
{
}

But the problem is the image is not displating when i tried to log…

NSLog(@"Our Image is= %@", _thumb2 ); is giving me NULL… help me to fix this…

  • 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-05-24T14:28:24+00:00Added an answer on May 24, 2026 at 2:28 pm

    First, you have a logic error in your getImage method:

    - (UIImage*)getImage:(NSURL*)myurl {
    
        SDWebImageManager *manager = [SDWebImageManager sharedManager];
        UIImage *cachedImage = [manager imageWithURL:myurl];
    
        if(!cachedImage) {
            [manager downloadWithURL:myurl delegate:self];
        }
        else {
            return cachedImage;
        }
    
        //execution will get here if there is no cached image; the "returned" value will be nil
    }
    

    If there is no cached image available, then your getImage call is going to return nil, which of course will not display correctly.

    Now I don’t know the exact specifics of how SDWebImageManager is intended to be used, but from your code it looks like it will almost certainly perform an asynchronous download of the requested image if a local copy isn’t immediately available in the cache. This means that you cannot call getImage and expect to immediately get back an image that you can display.

    You have a couple of options for fixing this:

    1. Implement that webImageManager:didFinishWithImage: method that you’ve got there to handle the image that the image-manager downloads asynchronously, and restructure your code to work with it.

    2. Get rid of the SDWebImageManager and use a synchronous request to download the image if it is not in the cache.

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

Sidebar

Related Questions

If I have the following code: NSUInteger i, count = [pages count]; for (i
NSInteger / NSUInteger are Cocoa-defined replacements for the regular built-in types. Is there any
In numberOfRecordsForPlot:... I have this code: int count = [[optsDict objectForKey:@Values] count]; NSLog(@pie count:
How can I save the string that match from one NSArray with one index
I have a method that asynchronously downloads images. If the images are related to
i want to add a data indicator line similar to the following image in
Update: Currently looking into NSSET's minusSet links: Comparing Two Arrays Hi guys, Could benefit
I have a class Test which has an array of Foos. I want to
My problem is this: I can't seem to access the variable todaysDate from the
Please note where I have the NSLOG. All it is displaying in the log

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.