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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:08:52+00:00 2026-05-26T00:08:52+00:00

I know this is pretty basic, but I can’t figure it out. I’ve got

  • 0

I know this is pretty basic, but I can’t figure it out.
I’ve got a basic model class (for simplicity i’ll leave just some properties)

@interface Marker : NSObject {
    NSInteger book_id;
    NSString *detail;
    NSNumber *lat;   
}

@property (nonatomic, assign) NSInteger book_id;
@property (nonatomic, retain) NSNumber *lat;
@property (nonatomic, retain) NSString *detail;

@end

@synthesize book_id, detail, lat;

- (id)init
{
    self = [super init];
    if (self) {
        detail = [NSString alloc];
        lat = [NSNumber alloc];
    }

    return self;
}

- (void) dealloc {
    [detail release];
    [lat release];
    [super dealloc];
}

@end

and I’ve got a singleton with simple method, I want to push instances of this class into that singletons array, i’ve got it like this

#import "Marker.h"

@interface MarkersSingleton : NSObject {
    NSMutableArray *markers;
}

+ (MarkersSingleton *)getInstance;
- (void)addMarker: (Marker *) marker;

@property (nonatomic, retain) NSMutableArray *markers;

@end

#import "MarkersSingleton.h"

@implementation MarkersSingleton

@synthesize markers;

- (id) init{
    self = [super init];

    if(self){
        markers = [[NSMutableArray alloc] init];
    }

    return self;
}

+ (MarkersSingleton *) getInstance {
    static dispatch_once_t pred;
    static MarkersSingleton *inst;
    dispatch_once(&pred, ^{
        inst = [[MarkersSingleton alloc] init];
    });

    return inst;
}

- (void) addMaker: (Marker *) marker {
    [markers insertObject:marker atIndex:[markers count]];
}

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

@end

and now when I try

Marker *marker = [[Marker alloc] init];

…some sets…

[[MarkersSingleton getInstance] addMarker:marker];

I get the “Program received signal: SIGABRT”. I also tried [marker copy] but I guess I’m missing a copy implementation for my class, should I implement the copy and then copy the marker before using addMarker or is there any other better way?
Thanks.

  • 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-26T00:08:53+00:00Added an answer on May 26, 2026 at 12:08 am

    In addition to the points in the comment thread above, where you do not initialize your variables properly, one guess would be that, in the code you showed us, you have misspelled the method addMarker: as addMaker:.

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

Sidebar

Related Questions

Know this might be rather basic, but I been trying to figure out how
This is a pretty basic MPI question, but I can't wrap my head around
I know this is a basic RTFM question but I'm pretty new to rails
I know this is a pretty basic question, but I don't know how to
This seems like a pretty basic question but I unfortunately don't know the answer
I know this is a pretty basic question, and I think I know the
I know this is a pretty basic regex, could someone explain what it is
I'm pretty sure I know the answer to this, but short of a virtual
So I'm pretty sure i already know the answer to this, but does the
So I think I'm doing something pretty basic. I know why this doesn't work,

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.