LessNeglect Objective-c Client
Send messages and events from your iOS app to LessNeglect!
-
Add a Reference to the LessNeglect library in your Project (either directly to the source, or via the LessNeglect Library)
- Add the LessNeglect library files to your project: File -> Add Files to " "
- Find and select the folder that contains the LessNeglect
- Make sure that "Copy items into destination folder (if needed)" is checked
- Set Folders to "Create groups for any added folders"
- Select all targets that you want to add the SDK to
-
Verify that libLessNeglect-ios.a has been added to the Link Binary With Libraries Build Phase for the targets you want to use the Library with.
-
In your Application Delegate:
- Import TestFlight: #import "lessneglect_ios.h"
- Get your Project Code and API Secret your LessNeglect settings page
- Add your Project Code and API Secret constants
#define kProjectCode @"your_project_code"
#define kAPISecret @"your_api_secret"
- Log events as they happen using the client:
- (void)registerNewUser {
LessNeglectConnection *con = [LessNeglectConnection connectionWithCode:kProjectCode key:kAPISecret];
//create a person object
Person *person = [[Person alloc] init];
person.email = @"name@example.com";
//create an event object
Event *event = [[Event alloc] init];
event.name = @"registered";
event.note = @"customer signed up from xyz campaign";
event.person = person;
[con createActionEvent:event success:^(NSDictionary *response) {
//parse the json response and do something with it if you want
} error:^(NSError *error) {
//handle the error if you'd like
}];
}
- (void)sendUserMessage {
LessNeglectConnection *con = [LessNeglectConnection connectionWithCode:kProjectCode key:kAPISecret];
//create a person object
Person *person = [[Person alloc] init];
person.email = @"name@example.com";
//create an event object
Message *message = [[Message alloc] init];
message.subject = @"Hi there";
message.body = @"What do you think of the app so far?";
message.person = person;
[con createMessage:message success:^(NSDictionary *response) {
//parse the json response and do something with it if you want
} error:^(NSError *error) {
//handle the error if you'd like
}];
}