보통 plist를 읽어올때 [NSBundle mainBundle] 을 사용하여 읽어오는데 단위 테스트를 할때 제대로 읽어오지 못하는 현상이 생긴다
이때 mainBundle 부분을 bundleForClass:[self class] 로 변경해주면 단위테스트를 할때도 제대로 plist의 path를 읽어온다
예
NSString * path = [[NSBundle bundleForClass:[self class]] pathForResource:@"ErrorMessage" ofType:@"plist"];
'iOS' 카테고리의 다른 글
NSFileManager 디렉토리 위치 정의 (0) | 2011.06.11 |
---|---|
objective C (xcode4) gcov 설정방법 (0) | 2011.06.07 |
KeychainItemWrapper 주의사항 (0) | 2011.05.25 |
Xcode4 cocoa touch Header comment Template 수정 (0) | 2011.04.26 |
UIAlertView - didDismissWithButtonIndex 이벤트 문제 (0) | 2011.04.11 |