TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Apache 2 |
ReleasedLast Release | Jul 2017 |
Maintained by Pitteri.
##Prerequisites
##Frameworks #####Add the frameworks below to your project:
#####Property list file Add the properties below to your project plist file:
#####Capabilities Add the Background Modes below to your target:
##Set up the SDK
###Cocoapods
Add the following line to your project's Podfile:
pod 'Findrix'
###Manual
##Initialization
#import <Findrix/Findrix.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Findrix start:@"userId" clientId:@"clientId" clientSecret:@"clientSecret" photo:devicePhoto callback:^(NSString *deviceId, NSError *error) {
if(error == nil) NSLog(@"Device created %@", deviceId);
else NSLog(@"Error creating device %@", error.description);
}];
];
}
- (void)applicationDidBecomeActive:(UIApplication *)application{
[Findrix activate];
}
#####Parameters:
IMPORTANT: Don't forget to call [Findrix activate]!
##Push notifications The first step is to create an App ID and the associated SSL certificate on the Apple Developer website. This certificate will allow the Parse server to send push notifications to the application identified by the App ID. If you already created the App ID and the associated SSL certificate, send the p12 file to Findrix dev team(Section Configuring your App ID for Development Push Notifications):
######Generating a Certificate Request To begin, we'll need a certificate signing request file. This will be used to authenticate the creation of the SSL certificate.
######Creating an App ID Every iOS application installed on your developer device needs an App ID. As a convention, these are represented by reversed addresses (ex. com.example.MyParsePushApp). For this push app, you can use an App ID you've already created, but make sure it does not contain a wildcard character ("*"). The following instructions cover the creation of a new App ID.
######Configuring your App ID for Development Push Notifications Now that you've created an App ID (or chosen an existing Explicit App ID), it's time to configure the App ID for Push Notifications.
######Creating the Provisioning Profile A Provisioning Profile authenticates your device to run the app you are developing. Whether you have created a new App ID or modified an existing one, you will need to regenerate your provisioning profile and install it. If you have trouble using an existing profile, try removing the App ID and setting it back. For this tutorial, we'll create a new one.
######Registering the device Now you must register the current device for push. If you already register your device for push notifications, go to step 3:
#import <UserNotifications/UserNotifications.h>
@interface TRLSAppDelegate : UIResponder <UIApplicationDelegate, UNUserNotificationCenterDelegate>
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
- (void)registerDeviceForPushNotifications{
if( SYSTEM_VERSION_LESS_THAN( @"10.0" ) )
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error)
{
if( !error )
{
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
}];
}
}
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self registerDeviceForPushNotifications];
}
Implement the callback method - application:didRegisterForRemoteNotificationsWithDeviceToken: in the app delegate. We need to inform Findrix about this new device:
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[Findrix setDeviceToken:deviceToken];
}
To handle a notification, implement the methods below in the app delegate:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
[Findrix applicationDidReceiveRemoteNotification:userInfo];
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{
[Findrix applicationDidReceiveRemoteNotificationWithNotification:notification];
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{
[Findrix applicationDidReceiveRemoteNotificationWithNotification:response.notification];
}
##Customize the UI for Your App Once you've set up your library integration, you can customize the UI to match the color scheme and branding of your app to ensure the best user experience for your users.
Import the class
#import <Findrix/FDXMessageAppearance.h>
You can customize the following properties
// Colors
[FDXMessageAppearance setTextColor:[UIColor blueColor]];
[FDXMessageAppearance setBackgroundColor:[UIColor grayColor]];
[FDXMessageAppearance setButtonBackgroundColor:[UIColor yellowColor]];
[FDXMessageAppearance setButtonTextColor:[UIColor greenColor]];
[FDXMessageAppearance setTitleColor:[UIColor blackColor]];
//Fonts
[FDXMessageAppearance setTitleFont:[UIFont systemFontOfSize:9.0]];
[FDXMessageAppearance setButtonTextFont:[UIFont boldSystemFontOfSize:18.0]];
[FDXMessageAppearance setTextFont:[UIFont italicSystemFontOfSize:12.0]];