【发布时间】:2011-03-19 17:52:03
【问题描述】:
我的问题类似于This SO question,但主要区别在于我使用的是类方法。一些代码:
OpenFeint+private.h
@interface OpenFeint (Private)
// ...
+ (void) createSharedInstance;
OpenFeint+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]];
错误是:
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 的东西都是一个静态库,是的,它也被编译和链接。这是我的第一个静态库,所以我可能只是错过了一些重要的步骤。有什么线索吗?
谢谢!
【问题讨论】: