방금 iOS 개발을 시작했으며 경고로 인해 막혔습니다. 빌드가 성공적이지만이 경고는 나를 귀찮게합니다. 다른 답변을 확인했지만 잘못된 점을 파악하지 못했습니다.불완전한 구현 - Xcode 경고
경고의 - 당신은 이러한 속성의 getter를 구현하지 않은
Complexnumbers.h
#import <Foundation/Foundation.h>
@interface ComplexNumbers : NSObject
-(void) setReal: (double)a;
-(void) setImaginary: (double)b;
-(void) print; // display as a + bi
-(double) real;
-(double) imaginary;
@end
Complexnumbers.m
#import "ComplexNumbers.h"
@implementation ComplexNumbers // Incomplete implementation
{
double real;
double imaginary;
}
-(void) print
{
NSLog(@"%f + %fi",real,imaginary);
}
-(void) setReal:(double)a
{
real = a;
}
-(void) setImaginary:(double)b
{
imaginary = b;
}
@end
"real"과 "imaginary"라는 2 개의 변수 *를 갖고 싶습니다. 맞습니까? 음, 대신에'real'과'imaginary'라고 불리는 2 * 함수가 있습니다.'.m' 파일에 함수로 구현되어 있지 않기 때문에,이 경고를 받고 있습니다 :). 여러분의 변수에 대해'@ property'와'@ synthesize'를 만드는 것에 대한 답 중 하나를 따르십시오. – Mxyk
마이크가 맞습니다. 처음에는 약간 혼란 스럽습니다. 수업은 배웠다. :) – vDog