2016-04-13 3 views
0

Was ist falsch an meinem Code?Kein sichtbares @interface für 'Kontakt' deklariert den Selektor 'initWithName: thumbnail: email:'

Ich habe auf google nach weiteren Informationen über den Fehler gesucht, konnte aber keine Lösung für mein Problem finden. Kann mir jemand helfen, dieses Problem zu lösen?

Der Fehler tritt in diesen Zeilen:

  1. self = [self initWithName: dic [@ "name"] Miniaturbild: dic [@ "Thumbnail"] email: dic [@ "E-Mail"]] ;
  2. self = [self initWithName: @ "Undefined" Vorschaubild: @ "Undefined" email: @ "Undefined"];

Contact.h

// 
// Contact.h 
// Teste 
// 
// Created by Samuel Neiva on 13/04/16. 
// Copyright (c) 2016 Samuel Neiva. All rights reserved. 
// 

#import <Foundation/Foundation.h> 

@interface Contact : NSObject 

@property (strong, nonatomic) NSString *name; 
@property (strong, nonatomic) NSString *thumbnail; 
@property (strong, nonatomic) NSString *email; 

- (id)initWithName:(NSString *)aName 
     thumbnail:(NSString *)aThumbnail 
      photo:(NSString *)aEmail; 

- (id)initWithDictionary:(NSDictionary *)dic; 

@end 

Contact.m

// 
// Contact.m 
// Teste 
// 
// Created by Samuel Neiva on 13/04/16. 
// Copyright (c) 2016 Samuel Neiva. All rights reserved. 
// 

#import "Contact.h" 

@implementation Contact 

- (id)initWithDictionary:(NSDictionary *)dic { 
    self = [self initWithName:dic[@"name"] thumbnail:dic[@"thumbnail"] email:dic[@"email"]]; 
    return self; 
} 

- (id)init { 
    self = [self initWithName:@"Undifined" thumbnail:@"Undifined" email:@"Undifined"]; 
    return self; 
} 

//The designated initializer 
- (id)initWithName:(NSString *)aName 
     thumbnail:(NSString *)aThumbnail 
      photo:(NSString *)aEmail { 

    self = [super init]; 

    if (self) { 
     self.name = aName; 
     self.thumbnail = aThumbnail; 
     self.email = aEmail; 
    } 

    return self; 
} 

- (NSString *)description { 
    return [NSString stringWithFormat:@"%@ : %@", self.name, self.description]; 
} 


@end 
+0

Dies muss ein Copy-Paste-Fehler sein: 'photo: (NSString *) aEmail' ->' email: (NSString *) aEmail' – dasblinkenlight

Antwort

0

Contact erklären nicht, dass die Methode, wie nur die Warnung sagt. Es erklärt initWithName:thumbnail:photo.

Verwandte Themen