2011-12-26 1 views
2

최근에 내 앱 프로젝트에서 ARC로 전환했습니다. iOS 5 SDK를 사용하고 있습니다. 하나의 iPod 4g 장치 실행 경고가 표시되지 않습니다. 그러나 아이팟 2g에 내 응용 프로그램을 실행하려고 나는 많은 경고를 얻을 :iOS5 ARC 앱 : __NSAutoreleaseNoPool() : NSCFNumber 클래스가 자동 풀링되어 자동 풀링되지 않음 - 방금 누출 됨

*** __NSAutoreleaseNoPool(): Object 0x258070 of class DataModel autoreleased with no pool in place - just leaking 
*** __NSAutoreleaseNoPool(): Object 0x2530a0 of class __NSArrayM autoreleased with no pool in place - just leaking 
*** __NSAutoreleaseNoPool(): Object 0x25a2e0 of class NSCFNumber autoreleased with no pool in place - just leaking 

나는 실행 ARM6/ARM7 코드의 차이는 ARC를 사용하여이 같아요.

해결 방법? 감사합니다.

답변

5

별도의 스레드에서 작업 할 때마다 @autoreleasepool 컨텍스트를 추가하는 것이 현명합니다.

More information available here.

괜찮은 예도 있습니다. to be found in this related question.

+0

응용 프로그램을 ARC로 전환 한 후 모든 자동 풀 풀을 제거했습니다. main.m 파일에 하나의 autorelease 풀만 있습니다. ARC 코드의 경우 autorelease pool을 사용할 필요가 없다고 생각합니다. 내가 맞습니까? – kesrut

+0

그래서 모든 NSAutoreleasePool 구조를 @autoreleasepool로 변환해야합니까? 그건 내 코드에서 모든 NSAutoreleasePool 구조를 제거했기 때문에 나쁘다. – kesrut

+0

Nope. '@ autoreleasepool' 컨텍스트 (또는 NSAutoreleasePool'도 잘 작동해야합니다 ... ARC와 함께 제공되는 새로운 양식이지만 IMO와 동등해야합니다)에서 계속 작업해야합니다. [이 관련된 질문은 오히려 말투입니다] (http://stackoverflow.com/questions/8364853/objective-c-autoreatic-reference-counting),하지만 좀 더 기술적 인 세부 사항을 제공해야합니다. –