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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:12:36+00:00 2026-05-23T05:12:36+00:00

This application is rewritten code from the Cococa and Objective C Up and Running

  • 0

This application is rewritten code from the Cococa and Objective C Up and Running book.

As I try to understand everything in the beginning, I would like to know, where I made a mistake, in the code below. To me, everything looks fine.

Could you, therefore, help me identify the source of the warning:

Incomplete Implementation

I got this in the @implementation Photo line in Photo.m source code file?

Photo.h

#import <Foundation/Foundation.h>


@interface Photo : NSObject{

    NSString* caption;
    NSString* photographer;    
}

+ (Photo*) photo;

- (NSString*) caption;
- (NSString*) photographer;

- (void) setCaption: (NSString*)input;
- (void) setPhotographer: (NSString*)input;

@end

Photo.m

#import "Photo.h"


@implementation Photo  // <- Incomplete Implementation?

- (id)init
{
    self = [super init];
    if (self) {
        [self setCaption:@"Default Caption"];
        [self setPhotographer:@"Default Photographer"];
    }

    return self;
}


+ (Photo*) caption {
    Photo* newPhoto = [[Photo alloc] init];
    return [newPhoto autorelease];
}


- (NSString*) caption {
    return caption;
}


- (NSString*) photographer {
    return photographer;
}


- (void) setCaption:(NSString *)input {
    ;
    caption = [input retain];
}


- (void) setPhotographer: (NSString *)input {
    [photographer autorelease];
    photographer = [input retain];
}


- (void)dealloc
{
    [self setCaption:nil];
    [self setPhotographer:nil];

    [super dealloc];
}

@end

I use Snow Leopard 10.6.7 and Xcode 4.0.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-23T05:12:36+00:00Added an answer on May 23, 2026 at 5:12 am

    Unless its a typo, your Class method defined as + (Photo*) Photo; is not implemented (there is a + (Photo*) Caption {} method which looks its just an accident.

    Edit: A simpler way to do have this functionality is to use properties, which are a shortcut that create the getter and setter for a variable for us, (see this link for a good beginner’s tutorial: iPhone 101) for your instance variables like so:

    in your .h file:

    @interface Photo : NSObject{
    
        NSString* caption;
        NSString* photographer;    
    }
    @property (nonatomic, retain) NSString *caption;
    @property (nonatomic, retain) NSString *photographer;
    @end
    

    in your .m file:

    @implementation Photo
    @synthesize caption, photographer;
    
        //Other stuff (init and any custom methods for class etc.. NOT getters and setters for variables)
        - (void)dealloc
        {
            ;
            [photographer release];
    
            [super dealloc];
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on this application that's sort of like a blog. I'm thinking about
I have this application that need to do some things in protected paths (like
I have this application I made on a utility based app. How would I
Here's some code from an FTP application I'm working on. The first method comes
I want to reuse some code logic from a self-hosted web application in my
In a windows forms application you can register event handlers like this: this.KeyDown +=
We are converting our application from using Sql Server Express (let's call this version
I have a page, Default.aspx, with its own code-behind file like this: using System;
I have old Delphi application. This app takes session key from server, do some
This application is using windows integrated authentication in IIS. No anonymous login. It's also

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.