2013-12-09 1 views
0

정말 새로운 선택기를 선언하지 않고이 문제에 대한 해결책을 찾을 수 없습니다'CompCost'에 대한 눈에 띄는 @interface은 다음과

내가 여기에, 다른 논리에 simillar 솔루션을

" No visible @interface for 'CompCost' declares the selector " occurs here 
logicForCompCost setAmountTermin:costTermin and for the whole segment 

그것은 잘 작동합니다.

CompPost.m

#import "CompCost.h" 
#import "AssEmployeeCost.h" 
#import "EmplyeeCost.h" 
#import "ResearchCost.h" 

@implementation CompCost 

-(void) AddAllCompanyCostInformation:(NSNumber *) costTermin 
        withTotalITCost:(NSNumber *) costIT 
        withTotalTeleCost:(NSNumber *) costTele 
        withTotalCleanCost:(NSNumber *) costClean 
        withTotalElCost:(NSNumber *) costEl 
        withTotalSuppCost:(NSNumber *) costSupp 
        withTotalElseCost:(NSNumber *) costElse; 
{ 

    CompCost *logicForCompCost = [[CompCost alloc]init]; 

    [logicForCompCost setAmountTermin:costTermin]; 
    [logicForCompCost setAmountIT:costIT]; 
    [logicForCompCost setAmountTele:costTele]; 
    [logicForCompCost setAmountClean:costClean]; 
    [logicForCompCost setAmountEl:costEl]; 
    [logicForCompCost setAmountSupp:costSupp]; 
    [logicForCompCost setAmountElse:costElse]; 

    if (!_totalCostComp) { 
     _totalCostComp = [[NSMutableArray alloc]init]; 

    } 

    [_totalCostComp addObject:logicForCompCost]; 

} 
@end 

및 CompCost.H

// 
// CompCost.h 
// Signium International 
// 
// Created by Simon Z. Kaczmarek on 09/12/13. 
// Copyright (c) 2013 Simon Z. Kaczmarek. All rights reserved. 
// 

#import <Foundation/Foundation.h> 

@interface CompCost : NSObject 

@property (nonatomic, strong)NSMutableArray* totalCostComp; 

-(void) AddAllCompanyCostInformation:(NSNumber *) costTermin 
        withTotalITCost:(NSNumber *) costIT 
        withTotalTeleCost:(NSNumber *) costTele 
        withTotalCleanCost:(NSNumber *) costClean 
        withTotalElCost:(NSNumber *) costEl 
        withTotalSuppCost:(NSNumber *) costSupp 
        withTotalElseCost:(NSNumber *) costElse; 


@end 

희망 누군가가 도움이 될 수 있습니다. 사이먼

답변

0

CompCost.h에 모든 메소드 서명을 추가

이 대답은 메소드의 본체가 CompCost.m 폴더에 존재하는 것으로 가정
-(void)setAmountTermin:(NSNumber*)amount; 

...


편집 : 난 그냥 해요 이 메소드를 CompCost.m에서 호출하려고한다는 것을 알았습니다. 이 메소드를 개인 메소드로 사용하려면 CompCost.m에 추가하고 CompCost.h에 추가 할 필요가 없습니다. costTermin과 전체 세그먼트에 대한

귀하의 오류, 당신을 어이 "말하는 :


여기 logicForCompCost setAmountTermin 발생" 'CompCost'에 대한 가시적 @interface 셀렉터를 선언한다 " 존재하지 않는 메소드를 호출하려고합니다. " 그 방법을 써야합니다. logicForCompCostCompCost입니다. 호출하려는 메소드의 이름이 표시된 선택기가 필요합니다. CompCost.m 파일에서 작업 중이므로 @interface (.h) 또는 @interface (.m) 개인을 쓸 수 있으며이 오류가 해결됩니다. 메소드 본문을 작성해야하지만 그래도됩니다. 당신이 @properties 이러한 일을 추가하는 경우


또는, 당신은 방법을 쓸 필요가 없습니다. 예를 들어 :

@property (nonatomic, strong) NSNumber* amountTermin; 

이 (당신이 그것을 할 방법에 따라 공개 또는 비공개 할 수 있음) @propertyamountTermin를 생성하고 NSNumber*를 받아 amountTermin에 할당하고 amountTermin 방법을 만드는 setAmountTermin 방법을 만들어 amountTermin (NSNumber*)을 반환합니다. @property을 사용하는 경우 도트 표기법을 사용하여 amountTermin에 액세스 할 수도 있습니다.


그리고 마지막으로 참고로 ... 당해 방법은이 경우에있어서,이 타입의 새로운 객체를 생성하고 또한에서 인스턴스 변수 배열에 추가 ... 전혀 의미가 없다 이 유형의 객체.여기에 조직적인 문제가 있습니다 ... 혼란스럽고 결국 문제로 이어질 것입니다 ...

관련 문제