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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:18:28+00:00 2026-05-24T01:18:28+00:00

I am working on an example from a book that I got and it

  • 0

I am working on an example from a book that I got and it doesnt seem to be working I am getting the warning Incomplete implementation. When I run the program I get an error singal “EXC_BAD_ACCESS”. The warning is in the .m file at the line return [NSString stringWithFormat:@"Name:... Does anyone know what I am doing wrong?

my .m file

#import "RadioStation.h"


@implementation RadioStation

+ (double)minAMFrequency {
    return 520.0;
}

+ (double)maxAMFrequency {
    return 1610.0;
}

+ (double)minFMFrequency {
    return 88.3;
}

+ (double)maxFMFrequency {
    return 107.9;
}

- (id)initWithName:(NSString *)newName atFrequency:(double)newFreq  atBand:(char)newBand {
    self = [super init];
    if (self != nil) {
        name = [newName retain];
        frequency = newFreq;
        band = newBand;
    }

    return self;
}

- (NSString *)description {
    return [NSString stringWithFormat:@"Name: %@, Frequency: %.1f Band: %@", name, frequency, band];
}

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

@end

My .h file

#import <Cocoa/Cocoa.h>


@interface RadioStation : NSObject {
    NSString *name;
    double    frequency;
    char      band;
}

+ (double)minAMFrequency;
+ (double)maxAMFrequency;
+ (double)minFMFrequency;
+ (double)maxFMFrequency;

-(id)initWithName:(NSString*)name
       atFrequency:(double)freq
            atBand:(char)ban;
-(NSString *)name;
-(void)setName:(NSString *)newName;
-(double)frequency;
-(void)setFrequency:(double)newFrequency;
-(char)band;
-(void)setBand:(char)newBand;

@end

radiosimulation.m file:

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    // insert code here...
    NSMutableDictionary* stations = [[NSMutableDictionary alloc] init];
    RadioStation* newStation;

    newStation = [[RadioStation alloc] initWithName:@"Star 94"
                                        atFrequency:94.1
                                             atBand:'F'];

    [stations setObject:newStation forKey:@"WSTR"];
    [newStation release];

    NSLog(@"%@", [stations objectForKey:@"WSTR"]);

    newStation = [[RadioStation alloc] initWithName:@"Rocky 99"
                                        atFrequency:94.1
                                             atBand:'F'];

    [stations setObject:newStation forKey:@"WKFR"];
    [newStation release];

    NSLog(@"%@", [stations objectForKey:@"WKFR"]);

    [stations release];
    [pool drain];
    return 0;
  • 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-24T01:18:28+00:00Added an answer on May 24, 2026 at 1:18 am

    You are declaring the following property accessor/mutators (getter/setters) but are not implementing them in your .m file.

    -(NSString *)name;
    -(void)setName:(NSString *)newName;
    -(double)frequency;
    -(void)setFrequency:(double)newFrequency;
    -(char)band;
    -(void)setBand:(char)newBand;
    

    You need to implement all 6 of these methods in the .m file if you want to remove the warning about incomplete implementation.

    You are effectively saying in the .h file that this is what your object is going to do, then not doing it in the .m. It won’t generate an error, as objective-c messaging means that the message will be handed up to NSObject to deal with, which will also not have any matching implementation, and the messages will just be silently ignored. I don’t like the way that this is only shown as a warning – but there you go.

    That said, I wouldn’t create the properties like this (there are neater ways of doing this in objective-c using @property), I would remove those method declarations in the .h and replace them with:

    @property (nonatomic, retain) NSString *name;
    @property (nonatomic, assign) double frequency;
    @property (nonatomic, assign) char band;
    

    These property declarations go in the same place as method declarations.

    and then add the following to the .m file:

    @synthesize name;
    @synthesize frequency;
    @synthesize band;
    

    This will avoid having to write all that boilerplate accessor/mutator code that you are currently missing. Again, these go in the same region of the code as method implementations. Effectively the compiler is going to create name and setName methods automatically.

    This code is untested – but should point you in the right direction for tidying up the incomplete implementation. It may fix your access error too – but that may require more detailed look at a stack trace.

    Another point I’m not sure the code as written even needs to use get/set methods or properties. You might try removing the method declarations from the .h and see if it works. It seems that all the accesses to name, frequency and band are all from within the object.

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

Sidebar

Related Questions

I am working on an example from a php book and am getting an
I am trying to get a simple example working from an assembly book I
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
I am working on getting parameter from a function string. For example, my function
Using Pylons verson 1.0: Working on the FormDemo example from the Pylons book: http://pylonsbook.com/en/1.1/working-with-forms-and-validators.html
I'm trying to learn programming by myself, I'm working from a book that has
I have a friend who was working on a c example from a book
I'm working for the first time with Forms Authentication, I'm using an example from
I've been studying from the book Pro Android 2. I'm working through a Service
On a separate thread I got a working example on how to translate my

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.