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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:55:32+00:00 2026-05-17T00:55:32+00:00

I have a custom data container object of type RowOfPlayerData. When I try to

  • 0

I have a custom data container object of type RowOfPlayerData. When I try to display a RowOfPlayerData object in NSLog, the system doesn’t know how to display it, so it just shows the address of the object.

I am trying to figure out how i can display, in an NSLog statement, what is at that address so i can use the data.

I am trying to build this on a tutorial about NSPredicate: http://doronkatz.com/how-to-do-amazingly-simple-searches-with-nsar

I have tried to do some sort of description of the output but not succeded.

I have tried to figure out how to do this so i can access the data. Here is the test code i have used and some output i currently have. BTW, i am new to this.

I would really appreciate if someone could help me display the data from the playerArray in the right format as i just don’t get this.

[CODE]

@interface RowOfPlayerData : NSObject {

    NSString    *playerName;
    NSString    *curGameType;
}

@property(nonatomic, retain)    NSString    *playerName;

@property (nonatomic, retain)   NSString    *curGameType;

-(void)addPlayerData2Array;

@end

here is the .m file:

-(void)addPlayerData2Array {


    NSLog(@">>addPlayerData2Array started<<");
    NSMutableArray *playerArray = [[NSMutableArray alloc] init];
    RowOfPlayerData *row;
    row = [[RowOfPlayerData alloc] init];
    row.playerName = @"Player1";
    row.curGameType = @"NORMAL1";
    NSLog(@"<#1> row.playerName: %@", row.playerName);
    NSLog(@"<#2> row.curGameType: %@", row.curGameType);
    [playerArray addObject:row]; 
    NSString *xx;
    xx = [playerArray objectAtIndex:0];

    NSLog(@"<#3> playerArray: %@", xx);

Output:

addPlayerData2Array started<<

2010-09-25 13:39:51.313 x1[3675:207] <#1> row.playerName: Player1

2010-09-25 13:39:51.314 x1[3675:207] <#2> row.curGameType: NORMAL1

2010-09-25 13:39:51.314 x1[3675:207] <#3> playerArray:

[/CODE]

  • 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-17T00:55:32+00:00Added an answer on May 17, 2026 at 12:55 am

    You have one problem here:

    [playerArray addObject:row]; 
    NSString *xx;
    xx = [playerArray objectAtIndex:0];
    NSLog(@"<#3> playerArray: %@", xx);
    

    row is a RowOfPlayerData object, not a string. Following @imaginaryboy’s advice, add a description method to your RowOfPlayerData class and make sure you get the class right when you’re pulling objects out of the array.

    RowOfPlayerData *xx = [playerArray objectAtIndex:0];
    NSLog(@"<#3> playerArray: %@", xx);
    

    All that being said, I don’t think you’re approaching this the correct way. You are calling an instance method -(void)addPlayerData2Array on an object, but then you are creating a brand new RowOfPlayerData and returning it in an array form. What you should be doing is this:

    -(void)addPlayerData2Array {
        return [NSArray arrayWithObjects:self.playerName, self.curGameType, nil];
    }
    

    If you’re calling this method on an object, you should probably be returning the data from that object.

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

Sidebar

Related Questions

I am trying to have a tree display custom data that looks like this.
The task: I am trying to create a custom data type and have it
How do i select elements that have my custom data attribute data-validate with jQuery
I have assigned a custom data attribute to some circles added to the Raphael
I have mastered creating custom data types and adding fields with CCK. Then I
I have a custom list view that is getting data from server and changing
I have a custom image file where the first block of data is ASCII
I have a custom listview, i successfully parse the data into a list but
I have written a custom Windows Service that writes data to a custom Event
We have created a custom dataset and populating it with some data. Before adding

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.