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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:37:18+00:00 2026-05-27T18:37:18+00:00

I come from more of an Android development background so apologies if this is

  • 0

I come from more of an Android development background so apologies if this is a stupid question, but it’s just wracking my brain and I can’t see what is wrong. I have a Singleton Class implementation as follows:

Header file:

@interface SingletonClass : NSObject
{
}

@property(nonatomic, retain) NSMutableArray *categoryArray;

+ (SingletonClass *)sharedInstance;
- (id) init;
- (void)setCategory: (NSMutableArray *) x;
- (NSMutableArray *)getCategory;

@end 

Class Implementation:

#import "SingletonClass.h"

@implementation SingletonClass
@synthesize categoryArray;


static SingletonClass *sharedInstance = nil;

+ (SingletonClass *)sharedInstance {
    if (sharedInstance == nil) {
        sharedInstance = [[super allocWithZone:NULL] init];
    }
    return sharedInstance;
}

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

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

    return self;
}

+ (id)allocWithZone:(NSZone*)zone {
    return [self sharedInstance];
}

- (id)copyWithZone:(NSZone *)zone {
    return self;
}

- (void)setCategory: (NSMutableArray *)category_array{
    categoryArray = category_array;
}

- (NSMutableArray *)getCategory{
    return categoryArray;
}

@end

I have 2 Tabs each of which I try to access the Singleton Object which holds the Arrays I need using:

SingletonClass* myapp = [SingletonClass sharedInstance];
categories = [myapp getCategory];

When switching tabs it works when the Singleton Object is not called, but as soon as I use it I get the SIGABRT error. (Think it’s a memory warning). Are Singleton Instances not sharable across Tabs?

  • 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-27T18:37:19+00:00Added an answer on May 27, 2026 at 6:37 pm

    Yes, singletons may certainly be shared across tabs.

    a) If you’re not using ARC, then your reference counting is off.

    b) This sounds like a reference counting offset (can happen with ARC, MRC or GC). There is a diagnostic mode “Enable Zombies”. Basically, it means that objects are not actually deallocated and ‘zombified’ when their reference count reaches zero. A zombified object will then note an error whenever it is messaged. You can use this and record reference counts for objects using the Zombies instrument in Instruments.

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

Sidebar

Related Questions

I come from frontend background, so I apologize if this db question seems dumb.
I come from more of a Java background. In the last year or two,
I come from more of a C# background yet am learning Ruby in my
I come from a more WPF application background and I'm used to bindings and
I come from a Java background. I am wanting to learn more about concurrency
I've come from iPhone background and am writing an android app. I've got a
I come from an Actionscript3 background and this is my first time writing any
I come from a C# background and need to become more familiar with JS.
I come from a mostly n-tier background, and I'm trying to move more towards
I come from a web-development background. I've been playing around with a bit of

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.