ARC와 호환되는 Objective-C 싱글톤을 구현하려면 어떻게 해야 하나요? Xcode 4.2에서 자동 참조 카운트(ARC)를 사용할 때 컴파일 및 동작이 올바른 싱글톤 클래스를 변환(또는 작성)하려면 어떻게 해야 합니까?이미 하고 있는 것과 같은 방법으로, 다음과 같이 합니다. + (instancetype)sharedInstance { static MyClass *sharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedInstance = [[MyClass alloc] init]; // Do any other initialisation stuff here }); return sharedInsta..