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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:33:47+00:00 2026-06-18T00:33:47+00:00

I have two classes one is Sample class and ServerConnection class. sample.m . .

  • 0

I have two classes one is Sample class and ServerConnection class.

sample.m

.
.
    ServerConnection *serverConnection = [[ServerConnection alloc]init:val1 _handler:serverConnectionHandler _connectionURL:url];
//    [NSThread detachNewThreadSelector:@selector(run) toTarget:serverConnection withObject:NULL];    
    [serverConnection performSelectorInBackground:@selector(run) withObject:NULL];

In serverConnection i have only two methods
ServerConnection.h

@interface ServerConnection : NSObject
{
//    NSString* url;
//    Handler* handler;
//    int action_code;
}

@property (nonatomic,retain) NSString* url;
@property (nonatomic,retain) Handler* handler;
@property (nonatomic,retain) NSNumber* action_code;

-(id) init:(int)_action_code _handler:(Handler *)_handler _connectionURL:(NSString *)_connectionURL;
-(void)run;

ServerConnection.m

- (id) init:(int)_action_code _handler:(Handler *)_handler _connectionURL:(NSString *)_connectionURL{
    if (self = [super init]) {
        action_code = 0;
        action_code = [[NSNumber alloc]initWithInt:_action_code];
        handler = [[Handler alloc]init:_handler];
        url = [[NSString alloc]initWithString:_connectionURL];
    }
    return self;
}

-(void)run
{
     NSLog(@"url--> %@",url);

   //Here using NSURLConnection to fetch data from server
}

when run methods starts i’ll get this error sometimes Excess bad access and after enabling zombie showing this error message
-[CFString release]: message sent to deallocated instance 0xf9978d0*
and
**malloc: error for object 0x11039420: pointer being freed was not allocated
set a breakpoint in malloc_error_break to debug**

i referred old posts and tried to solve but still facing the same issue. anyone please point me where i am doing mistake?

  • 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-18T00:33:49+00:00Added an answer on June 18, 2026 at 12:33 am

    I don’t see anything wrong here with your url ivar. Is this your whole code? What’s the ServerConnection lifecycle? Monday morning can be the reason that I don’t see anything suspicious … Few additional comments …

    action_code = 0; line is useless, because you’re assigning NSNumber on the next line. And action_code is NSNumber, so, even if you want to assign 0 to it, you should write action_code = @( 0 ).

    Also the style … action_code should be named as actionCode. The init... method should look like:

    - (id)initWithActionCode:(int)actionCode handler:(Handler *)handler connectionURL:(NSString *) connectionURL {
    

    And if (self = [super init]) { should look like if ( ( self = [super init] ) ) { or use two liner:

    self = [super init];
    if ( self ) {
    

    You should improve your style to make your code more readable by others.

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

Sidebar

Related Questions

I have two classes (MVC view model) which inherits from one abstract base class.
I have two classes, one that inherits from the other. The base class is
I have two (unrelated) classes. The first one is Point: typedef std::complex<double> complex_number; class
I have the following two classes, one inherits from the other Class A{ void
I have two classes. One class works does the calculations, whilst the other is
I have two classes one of which inherits from the other. Im trying to
Starting to learn Canvas and have two classes so far (main one to call
First I want to describe my situation briefly. I have two classes, one MainClass
I have created two viewController classes such that one is superclass of another.i have
i have two data classes which hold only data members(no functions). One is CallTask

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.