From a4e195a56ded8a792f9f881a353b54c48018783b Mon Sep 17 00:00:00 2001 From: Amir Farsad Date: Mon, 5 Nov 2018 15:16:29 +0330 Subject: [PATCH] Update README.md Getting Started guide for iOS Platform --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index 7a8d5dc..0415c68 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,58 @@ Blow some breath into your app with Chabok realtime messaging and receive push notifications across all platforms with zero code. Know your users better, push them the content based on their location or track their presence/location without headache. +## Getting started guide for iOS + +1. The native iOS SDKs need to be setup using Cocoapods. In your project's `ios` directory, create a Podfile. +```bash +$ cd ios +$ pod init +``` +2. Edit the Podfile to include `ChabokPush` as a dependency for your project, and then install the pod with `pod instal`. +```bash +use_frameworks! +platform :ios, '9.0' + +target 'YOUR_TARGET_NAME' do + + # Pods for AwesomeProject + pod 'ChabokPush' + +end +``` + +3. Open the iOS project with .xcworkspace file in Xcode and also, open the `node_modules/react-native-chabok/` directory. Move the `ios/AdpPushClient.h` and `ios/AdpPushClient.m` files to your project. + +4. Import inside `AppDelegate`: +```objectivec +#import + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + if ([PushClientManager.defaultManager application:application didFinishLaunchingWithOptions:launchOptions]) { + NSLog(@"Application was launch by clicking on Notification..."); + } + + ... + } + +- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{ + // Hook and handle failure of get Device token from Apple APNS Server + [PushClientManager.defaultManager application:application +didFailToRegisterForRemoteNotificationsWithError:error]; +} + +- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ + // Manager hook and handle receive Device Token From APNS Server + [PushClientManager.defaultManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; +} + +- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{ + // Manager hook and Handle iOS 8 remote Notificaiton Settings + [PushClientManager.defaultManager application:application didRegisterUserNotificationSettings:notificationSettings]; +} + +``` + ### Installation See ChabokPush [iOS Framework](http://doc.chabokpush.com/ios/installation.html) installation document.