Take the 2-minute tour ×

I'm new to ios programming and stuck in my second tutorial which called Your Second iOS App about bird sighting in developer.apple.com. At the end of the 'Displaying Information in the Detail Scene' section when i run the code i get the "no visible @interface for 'birdsighting' declares the selector 'initwithname:location:date:' " error in BirdSightingDataController.m file at the "sighting = [[BirdSighting alloc] initWithName:@"Pigeon" location:@"Everywhere" date:today];" line. I checked the document lots of times and did the tut again but couldnt find how to i correct this?

#import "BirdSightingDataController.h"
#import "BirdSighting.h"
@interface BirdSightingDataController ()
- (void)initializeDefaultDataList;
@implementation BirdSightingDataController
- (void)initializeDefaultDataList {
    NSMutableArray *sightingList = [[NSMutableArray alloc] init];
    self.masterBirdSightingList = sightingList;
    BirdSighting *sighting;
    NSDate *today = [NSDate date];
    [self addBirdSightingWithSighting:sighting];
- (void)setMasterBirdSightingList:(NSMutableArray *)newList {
    if (_masterBirdSightingList != newList) {
        _masterBirdSightingList = [newList mutableCopy];
- (id)init {
    if (self = [super init]) {
        [self initializeDefaultDataList];
        return self;
    return nil;
- (NSUInteger)countOfList {
    return [self.masterBirdSightingList count];
- (BirdSighting *)objectInListAtIndex:(NSUInteger)theIndex {
    return [self.masterBirdSightingList objectAtIndex:theIndex];
- (void)addBirdSightingWithSighting:(BirdSighting *)sighting {
    [self.masterBirdSightingList addObject:sighting];

Birdsighting.h file

#import <Foundation/Foundation.h>

@interface BirdSighting : NSObject

@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *location;
@property (nonatomic, strong) NSDate *date;
-(id)initWithName:(NSString *) name locaiton:(NSString *)location date:(NSDate *) date;

share|improve this question
Good of you to copy in your BirdSightingDataController code into this question, but what you really should be copying into here is the contents of your "BirdSighting.h" file. You're likely missing that "initWithName: location: date:" method declaration (and maybe also implementation). –  Michael Dautermann Nov 24 '12 at 13:36
add comment

closed as too localized by Carl Veazey, Stony, Alex, RandomSeed, RaYell Mar 22 '13 at 9:33


1 Answer

up vote 0 down vote accepted

Check Birdsighting.h and make sure that the method

- (id)initWithName:(NSString *)name location:(NSString *)location date:(NSDate *)date;

is declared there. This essentially tells other classes what methods are available to instances of the Bidsighting class.

Its possible there is a typo in the interface declaration (this happens even in apple samples).

share|improve this answer
added BirdSighting.h file –  user1849505 Nov 24 '12 at 13:49
locaiton is not spelled correctly :) –  Edwin Iskandar Nov 24 '12 at 13:50
now its working thanks, my bad :( –  user1849505 Nov 24 '12 at 13:53
no problem - happens to everyone –  Edwin Iskandar Nov 24 '12 at 14:02
add comment
