0
명령 줄 응용 프로그램에서 두 클래스 (FirstClass 및 SecondClass)를 만들었습니다. FirstClass 메서드에서 SecondClass 객체를 만들었습니다. 이제 main에서이 메소드를 호출하고 해당 객체에 할당 된 메모리를 해제하려고합니다. 다음과 같이 내 코드는 내가 대한 합성 속성을 가정하고클래스에서 다른 클래스의 객체를 해제하는 방법은 무엇입니까?
int main (int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
// NSLog(@"Hello, World!");
NSMutableArray *arrayMain = [[NSMutableArray alloc]init];
arrayMain = [FirstClass addObject];
for (int i = 0; i<[arrayMain count]; i++) {
NSLog(@"%@",[[arrayMain objectAtIndex:i] name]);
}
NSLog(@"%ld",[arrayMain retainCount]);
}
return 0;
}
한 번 봐, retainCount는 쓸모가 왜 수많은 이유 중 0 하나를 반환 할 수 없습니다. – bbum