Search code examples
iphoneiossdksharekit

Cant use Sharekit. "ShareKit must be configured before use"


If I use the DefaultSHKConfigurator class it tells me it needs to be configured before use.

 *** 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'

So if I create a custom SHK configurator instead which extends DefaultSHKConfigurator it says that there is a 'Duplicate Interface Definition for class 'DefaultSHKConfigurator''

In this case Here is the applicationDiDfinishLaunching I am creating the configurator in:

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

if it is using the DefaultSHKConfigurator the I cahnge the code to alloc and init a DefaultSHKConfigurator.... However neither methods stop me from getting this error that I dont really understand.

FIX:

It needs to be called in.

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

Solution

  • FIX: It needs to be called in

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