2010-07-22 4 views
2

내 질문은 This SO question과 비슷하지만 가장 큰 차이점은 클래스 메서드를 사용하고 있다는 것입니다. 일부 코드 :클래스에 전송 된 인식 할 수없는 선택기를 해결하는 방법은 무엇입니까?

오픈 페인트 + private.h

@interface OpenFeint (Private) 
// ... 
+ (void) createSharedInstance; 

오픈 페인트 + private.mm

+ (void) createSharedInstance 
{ 
    //... 
} 

OpenFeint.mm

+ (void) initializeWithProductKey:(NSString*)productKey 
     andSecret:(NSString*)productSecret 
     andDisplayName:(NSString*)displayName 
     andSettings:(NSDictionary*)settings 
     andDelegates:(OFDelegatesContainer*)delegatesContainer 
{ 
    [OpenFeint createSharedInstance]; 
    // ... 

MyApp.mm :

// ... 
#import "OpenFeint.h" 
// ... 
[OpenFeint initializeWithProductKey: OF_PRODUCT_KEY 
     andSecret: OF_PRODUCT_SECRET 
     andDisplayName: OF_DISPLAY_NAME 
     andSettings: openFeintSettings 
     andDelegates: [OFDelegatesContainer containerWithOpenFeintDelegate: self]]; 
012 3,516,

그리고 오류는 다음과 같습니다

2010-07-22 11:30:15.239 MyApp[20210:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[OpenFeint createSharedInstance]: unrecognized selector sent to class 0x1cdb1c' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x02d6f919 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x02ebd5de objc_exception_throw + 47 
    2 CoreFoundation      0x02d714eb +[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x02ce1116 ___forwarding___ + 966 
    4 CoreFoundation      0x02ce0cd2 _CF_forwarding_prep_0 + 50 
    5 MyApp        0x0002844d +[OpenFeint initializeWithProductKey:andSecret:andDisplayName:andSettings:andDelegates:] + 48 
     // ... 

모든 것이 잘 & 링크를 컴파일,하지만 난이 바보 같은 오류를 얻고있다.

마지막으로 한 가지 - OpenFeint의 모든 내용은 정적 라이브러리이며, 예, 컴파일 된 &도 마찬가지입니다. 이것은 첫 번째 정적 라이브러리이므로 일부 중요한 단계를 빠뜨린 것 같습니다. 모든 단서?

감사합니다.

답변

7

흠, 나는 found a workaround 인 것 같지만 정확한 수정인지 잘 모르겠습니다. 링커 플래그 -all_load (-ObjC에 추가)를 추가 했으므로 이제는 모두 작동하는 것 같습니다.

질문 수정/추가 : "합법적 인"수정입니까? 더 좋은가요?

+0

예. 그것은 정당한 해결책입니다. 정적 라이브러리에서 모든 것을로드하려면이 작업을 수행해야합니다. –

2

OpenFeint + private는 카테고리이므로 어디에서나 OpenFeint + private.h 파일을 가져 오지 않으면 호출 할 때마다 selector not recognized 오류가 발생합니다. 마치 메서드를 전혀 정의하지 않은 것입니다.

관련 문제