오류 메시지가 표시되지만이를 제거하는 방법을 모르 십니다.xcode, alloc에 대한 오류를 분석하십시오.
-- Method returns an Objective-C object with a +1 retain count (owning reference)
라인 AAA 및 BBB
+ (CustConf*) initEmptyCustConf {
CustConf* theObject = [[CustConf alloc] init];
theObject.ID = 0;
theObject.aAA= [[NSString alloc] initWithString:@""];
theObject.Number_Ndx = 0;
theObject.bBB = [[NSString alloc] initWithString:@""];
return [theObject autorelease];
}
왜 그런가? (미안 미안 기본이 경우) [CustConf alloc] init에서 오는 객체는 자동으로 retaincount를 1로 유지합니까? – Franck
잘 모르겠습니다. CustConf.m 파일의 코드를 표시 할 수 있습니까? 그렇다면 볼 수는 있지만 배부하는 것은 1 유지 카운트를 주어야하며, 자동 리 레이스 (올바른 작업)는 앞으로 언젠가 -1이 될 것입니다. 그래서 모든 것이 정확합니다. 그것은'CustConf' 클래스의'alloc' 또는'init' 메쏘드 안에 있어야합니다. – chown
질문에 대한 theObject.aAA = @ ""대 theObject.aAA = [[NSString 할당] initWithString : @ ""] 값을 설정해야하더라도 할당 할 필요가 없습니까? [[NSString alloc] initWithString : @ "My int value"]; – Franck