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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:05:53+00:00 2026-06-15T23:05:53+00:00

SOffer[26229:c07] current Product: ( { id = 20; image = img2.png; name = offer

  • 0
SOffer[26229:c07] current Product: (
    {
        id = 20;
        image = "img2.png";
        name = "offer 2";
    }
)

I have product which result the above when I print it through NSLog,, I need to print the these individually. Following code generate this

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:@"cell"];
        }
        NSString *currentProductName;
        currentProductName = [productKeys objectAtIndex:indexPath.row];

        currentProduct = [products objectForKey:[productKeys objectAtIndex:indexPath.row]];
        NSLog(@"current Product: %@",currentProduct);
        //currentProductName = [currentProduct objectForKey:@"image"];
        //currentProduct = [currentProduct ];

        [[cell textLabel] setText:currentProductName];

    return cell;
    } 

currentProduct is declared as NSArray but when i try to print with objectForKey it say No visible interface for NSArray declares the selector ObjectForKey

  • 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-15T23:05:54+00:00Added an answer on June 15, 2026 at 11:05 pm

    objectForKey, I believe works with NSDictionary only.

    NSArray does not have key value pairs. Unless currentProduct holds the JSON file, then you gonna have to first get out the Array Object of the first Product and assign it to a NSDictionary, where you can then use the objectForKey to get your image value.

    Something like this:

    // Get the first product object from the NSArray. Assuming you dropped your entire Product values into a NSArray
    NSMutableDictionary *prodDict = [currentProduct objectAtIndex:indexPath.section];
    NSString *prodID = [prodDict objectForKey:@"id"];
    NSString *prodName = [prodDict objectForKey:@"name"];
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our application we have some data structures which amongst other things contain a
I'm trying to write my own little HTML helper which acts a lot like
We are looking for a way to timeout an iPhone application, and have tried
So I currently have an application that is fairly complex with large-scale animations and
I have an ASP.NET web site that responds with multiple skins depending on the
I have currently evaluating Java based security frameworks, I am a Spring 3.0 user
I have a particular SQL query that seems to suffer from a mysterious performance
I have been creating Spinner controls (Combo boxes/Drop downs) in one of my apps,
I have been building ASP.NET MVC application and I'm worried about potential multi-threading issues
Using hashing algorithms like md5 we suffer from a limited entropy which means that

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.