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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:26:28+00:00 2026-06-03T03:26:28+00:00

Okay, so I’m pretty new to xcode but I cannot find something specific to

  • 0

Okay, so I’m pretty new to xcode but I cannot find something specific to this issue anywhere. So I declare the array and instantiate it in the following files:

    //xmlToUrl.h

#import <Foundation/Foundation.h>


@interface xmlToUrl : NSObject {
    NSMutableArray *field;
    NSMutableArray *name;
}
@property(nonatomic, retain)NSMutableArray *field;
@property(nonatomic, retain)NSMutableArray *name;

@end

and

    //xmlToUrl.m

#import "xmlToUrl.h"

@implementation xmlToUrl
@synthesize field;
@synthesize name;

-(void)dealloc
{
    [field release];
    [name release];
    [super dealloc];    
}

@end

So this is where I am confused. I don’t know how to correctly “alloc” or “init” the mutable arrays, nor how to handle the add/remove operations from another file which inherits xmlToUrl.h.

The code (in the other file) as I have it now just prints null. Its listed below. What am I doing wrong?!?

//nodeContent is just a NSMutableString

[xmlToUrlObject.name addObject:nodeContent];
        NSLog(@"xml Name = %@", xmlToUrlObject.name);

       //I omitted all the operational code here but if I NSLog nodeContent it prints the correct values

[xmlToUrlObject.field addObject:nodeContent];
        NSLog(@"xml Field = %@", xmlToUrlObject.field);
  • 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-03T03:26:30+00:00Added an answer on June 3, 2026 at 3:26 am

    You need an init function in your implementation file, it would look similar to the following

    -(id) init
    {
      self = [super init];
      if (self) {
        field = [[NSMutableArray alloc] init];
        name = [[NSMutableArray alloc] init];
      }
      return self;
    }
    

    Then whenever you create an instance of your xmlToUrl class via [[xmlToUrl alloc] init] you will have an instance of your class that has already initialized your two NSMutableArrays

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

Sidebar

Related Questions

Okay, so I did all the research for this issue but none of the
Okay, so this should be a simple question, but I'm fairly new at programming,
okay so this is probably a soft pitch question for sombody, but I want
Okay, I have done a bit of searching online and found this thread, but
Okay people, I'm sure someone has had this issue and can help me out.
Okay, so this is a long long shot but here it goes... When IE
Okay, this one is pretty obvious to everyone who use Django and frequently asked
Okay, so I've known about this for like 600 years now, but I've only
Okay I got some good advice for Mobile Detection but still having an issue
Okay so im working on this php image upload system but for some reason

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.