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

  • Home
  • SEARCH
  • 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 6221343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:06:59+00:00 2026-05-24T08:06:59+00:00

im pretty new to xcode, so sorry if these are basics but im having

  • 0

im pretty new to xcode, so sorry if these are basics but im having the next issue: i have a class Data that contains string friendID and string friendName.
then i also have an array dataArray of these classes. now how do i access an ID or Name inside the array of classes?

this doesnt seem to work and i cant find any other solution:

[[dataArray objectAtIndex:i] valueForKey:@"friendID"]

and if its relevant, i made dataArray like this and it works:

if(friendDataEmpty==YES)
{
    NSMutableArray *tmpFriendID = [data valueForKey:@"id"]; // parsed data
    NSMutableArray *tmpFriendName = [data valueForKey:@"name"]; // parsed data

    for(int i=0;i<[tmpFriendID count];i++)
    {
        Data *data = [[Data alloc]init];
        data.friendID = [tmpFriendID objectAtIndex:i];
        data.friendName = [tmpFriendName objectAtIndex:i];
        [dataArray addObject:data];
        [data release];
    }
}

and thats the header of data

@interface data : NSObject {
NSString *friendID;
NSString *friendName;
}

@property (nonatomic, copy) NSString *friendID;
@property (nonatomic, copy) NSString *friendName;
  • 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-24T08:06:59+00:00Added an answer on May 24, 2026 at 8:06 am

    Try it like this.

    data *dat = (data *)[dataArray objectAtIndex:i];
    NSString *friendID = data.firnedID;
    
    // to set the value
    data.firnedID = someValue;
    

    Side Note: You should consider following the proper naming convention while you name your classes, methods, vars and other things. The “data” class should have been named “Data“.

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

Sidebar

Related Questions

I am pretty new to php, but I am learning! I have a simple
I am pretty new to xcode so forgive my mistakes but I am trying
Pretty new to iOS dev, I feel I have a grasp of the basics.
I'm pretty new here so don't have much idea about it. So sorry for
So I'm pretty new to Xcode and Objective-C. I have several ArtPiece objects with
I'm pretty new to cocoa and Xcode, I've done some basic C coding, but
Hellow stackoverflow people, I am pretty new to Cocoa. I have XCode 3.1 Situation:
Im pretty new to Java Web Services, but I cant find a good explanation
I'm pretty new to regular expressions. I have a requirement to replace spaces in
Hihi all, I am pretty new in iPhone dev. I have follow some tutorial

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.