This guide will walk you through adding Shine to your iOS application.
##Getting started##
To begin using Shine you will need to acquire your unique application key. Currently these applications keys are given out on an ad-hoc basis by Soundwave. Please contact Soundwave if you have not received your key or would like to enquire about receiving a key.
Check out the example Shine app above for help getting started.
###Requirements###
Shine SDK requires iOS 7.1+
###Cocoapods Installation###
Shine can be installed using Cocoapods. Simple add the following to your Podfile and run pod install
.
pod 'Shine', '~>1.2.1'
###Manual Installation###
Shine SDK can also be installed manually.
- Download the latest Shine framework from the root folder of this repository.
- Drag Shine.framework into your Xcode project, ticking the “Copy items if needed” checkbox.
Add Other Linker Flag
- Select your Xcode project in the file navigator sidebar.
- In the main pane, select your project, and then go to the “Build Settings" Tab.
- Search for “Other Linker Flags”.
- Double click the “Other Linker Flags” row’s value area, on the right side. A pop-up should appear.
- Add “-ObjC” by pressing the + button if it is hasn’t already been added
##Initializing Shine##
To begin using Shine follow these steps:
- Import Shine into your
AppDelegate
class
#import <Shine/Shine.h>
- Add the following to your method
willFinishLaunchingWithOptions
. At this point you will need to provide your unique application key which is available by contacting Soundwave.
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Shine setDeveloperKey:@"<Your-Dev-Key>"];
return YES;
}
Once you have added this code, Shine will start capturing data once your app launches.
##User Registration##
You can capture user registration data by adding the following code to your app:
...
//Create a new Shine user
SWUser *shineUser = SWUser.new;
shineUser.firstName = @"John";
shineUser.lastName = @"Smith";
shineUser.email = @"[email protected]";
//Register the user with Shine
[Shine registerUserDetails:shineUser];
...
##Optional Integration Points##
The following Shine integration points are not mandatory when using Shine.
###Location Capture###
Shine can capture a device's location if the host app has the required location services permissions. To capture location data, you need to add the following code to a class that conforms to the CLLocationDelegate protocol.
#import <Shine/Shine.h>
...
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
[Shine updateLocation:locations];
}
Shine location tracking works for both kCLAuthorizationStatusAuthorizedAlways and kCLAuthorizationStatusAuthorizedWhenInUse. However, location data is only associated with song plays when the host app has kCLAuthorizationStatusAuthorizedAlways permission.
An example of capturing location data is available in the example app.
###Contacts Syncing###
Shine can capture a device's contacts if the host app has the required contacts access permissions. Make a call to [Shine syncContacts]
after permission to access contacts has been granted.
#import <Shine/Shine.h>
ABAddressBookRequestAccessWithCompletion(ABAddressBookCreateWithOptions(nil, nil), ^(bool granted, CFErrorRef error) {
if (granted) {
[Shine syncContacts];
}
});
An example of syncing contacts data is available in the example app.
##Troubleshooting##
Q. I don't think Shine is capturing any data
A. Turn on logging before you set your Developer Key. Shine logs will tell you if there are any problems capturing data.
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Shine enableLogging];
[Shine setDeveloperKey:@"<Your-Dev-Key>"];
return YES;
}
Q. I get an error "Undefined symbols for architecture"
A. Make sure you have added -ObjC
to your Other Linker Flags
Q. I get an error "Shine Authorization Failed: Please Enter A Valid Developer Key"
A. Make sure you have a valid Developer Key and have entered it correctly. Please contact Soundwave to obtain a Developer Key.