-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
ShareKit needs a fair amount of configuration to ensure that it works correctly. The most basic configuration necessary consists of the name and URL of your app. The section that most impacts the sharing functionality of your app is the credentials for the various sharers. Additionally, the ShareKit interface (colors, transitions, etc) can be configured.
Most of the web services that ShareKit integrates require you to use an API key when connecting. An API key is a unique identifer that tells the service what app is making the request.
You have to sign up for each api key, but they are all free and sign-ups are quick. Here are some links that might help you get through the process even quicker.
If you look at DefaultSHKConfigurtor.m file, you will see instructions and links for each web service, which should help you to go through this smoothly.
ShareKit is intended to be incorporated as a submodule, and we moved configuration out of the ShareKit source code. This is a significant change, if you were used to configure it old SHKConfig.h way. The old way is still working for compatibility with older apps.
To avoid the issue of modifying the ShareKit source code when configuring, you should create DefaultSHKConfigurator subclass, and save it outside of ShareKit folder. DefaultSHKConfigurator is a configuration template, and provides empty (or default) implementations for all of the configuration methods. In your subclass, override the methods for which you have a custom configuration value.
Once your custom configurator has been written, ShareKit needs to be made aware of its existence. This should be done as early as possible in your application's lifecycle, preferably in the applicationDidFinishLaunching: method of your UIApplicationDelegate. The necessary line of code is (assuming your configuration delegate is called MySHKConfigurator):
DefaultSHKConfigurator *configurator = [[MySHKConfigurator alloc] init];
[SHKConfiguration sharedInstanceWithConfigurator:configurator];
[configurator release];
The original method of configuring ShareKit was to modify the provided SHKConfig.h header file. It contains preprocessor definitions for each configuration parameter. This method is still supported, but isn't recommended because it requires modifying the ShareKit source code, which is inconvenient when ShareKit is included as a git submodule in your project.
For those who wish to configure ShareKit this way, the configuration file is located at sharekit/Classes/ShareKit/SHKConfig.h. The comments around each preprocessor definition in the file explain the acceptable values.
Please be aware, that new configuration items are being added only to DefaultSHKConfigurator. SHKConfig.h should be considered as deprecated.