2012-09-06 27 views
1

如果我使用DefaultSHKConfigurator類,它告訴我它需要在使用前配置。不能使用Sharekit。 「ShareKit必須在使用前配置」

*** Terminating app due to uncaught exception 'IllegalStateException', reason: 'ShareKit must be configured before use. Use your subclass of DefaultSHKConfigurator, for more info see https://github.com/ShareKit/ShareKit/wiki/Configuration. Example: ShareKitDemoConfigurator in the demo app' 

所以,如果我創建一個自定義新鴻基配置,而不是延伸DefaultSHKConfigurator它說,有一個'Duplicate Interface Definition for class 'DefaultSHKConfigurator''

在這種情況下,這裏是我創造的組態程序的applicationDidFinishLaunching:

-(void)applicationDidFinishLaunching:(UIApplication *)application{ 
    NSLog(@"application did finish launching."); 
    DefaultSHKConfigurator *configurator = [[CustomSHKConfigurator alloc] init]; 
    [SHKConfiguration sharedInstanceWithConfigurator:configurator]; 
} 

如果它使用的是DefaultSHKConfigurator,那麼我會調用代碼來分配並初始化一個DefaultSHKConfigurator ....但是,這兩種方法都不能阻止我得到我不瞭解的錯誤。

FIX:

它需要在被稱爲

  • (BOOL)應用:(UIApplication的*)應用didFinishLaunchingWithOptions:(NSDictionary的*)launchOptions {
+0

我想通了。 ...它需要在 - (BOOL)應用程序中調用:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { – jimbob

+1

'applicationDidFinishLaunching'從iOS 3.0開始折舊。 – danielbeard

+0

喲感謝額外的信息隊友:) – jimbob

回答

1

FIX:它需要在

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
+0

謝謝!它像魅力 –

+0

沒問題的隊友:)。 – jimbob