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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:58:06+00:00 2026-05-24T17:58:06+00:00

In Objective-c, I have variables set in the interface file: #import <Cocoa/Cocoa.h> @interface TestApp_BotAppDelegate

  • 0

In Objective-c, I have variables set in the interface file:

#import <Cocoa/Cocoa.h>

@interface TestApp_BotAppDelegate : NSObject <NSApplicationDelegate> 
    {
   NSString * someString;
    }
- (IBAction) doSomething:(id)sender;

@end

And have this

#import "TestApp_BotAppDelegate.h"
@implementation TestApp_BotAppDelegate

@synthesize window;
@synthesize Buildings;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
    someString=@"HELLO";
    }

- (IBAction) doSomething:(id) sender
    {
    NSLog(@"%@", someString);
    }
@end

When i call doSomething from a button in the UI, I get a bad access error.

I know you that this is supposed to happen, but I don’t know why or a workaround.

Thanks,
Will


  • 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-24T17:58:07+00:00Added an answer on May 24, 2026 at 5:58 pm

    You are getting a bad access error because the string is not being properly managed in memory as explained in this question: EXC_BAD_ACCESS signal received. According the the code you posted you are never allocing and initializing someString, and therefore never releasing it. I believe you are not receiving null because the someString object never is taking up any memory to begin with.

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

Sidebar

Related Questions

Say I have a class like this: @interface MyAwesomeClass : NSObject { @private NSString
Can a Objective c interface have more than one implementation? Example I could have
I have Objective C code creating an NSUrlConnection as follows: //prepar request NSString *urlString
I have an objective-c class with member variables. I am creating getters and setters
Possible Duplicate: Objective C Equivalent of PHP’s Variable Variables I have a UIButton action,
Possible Duplicate: Objective C Equivalent of PHP's “Variable Variables” I'm studding Objective-C and have
Possible Duplicate: How to use global variables in Objective-C? In my Login.m file, I
I have a class like this: @interface MyCollection : NSObject { NSMutableDictionary *data; }
I have some Objective-C code that looks like this: #define myVar 10 float f
I have an objective-c application for OS X that compares two sqlite DB's and

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.