PepperKit-iOS 1.0.3-beta.1

PepperKit-iOS 1.0.3-beta.1

测试已测试
语言语言
许可证 MIT
发布最后发布2015年1月

Himanshu Retarekar 维护。



PepperKit-iOS 1.0.3-beta.1

PepperKit-iOS

PepperKit-iOS 允许开发者开发集成 PepperKit 功能的应用程序。

概述

SDK 的主要目的是让使用 PepperKit 平台变得容易。它提供了两个客户端之间启动聊天的功能。以下提供更多信息,或查看 完整文档 了解 SDK 中所有可用的类。

通过 CocoaDocs 访问 PepperKit-iOS SDK 的推荐方法是。

本文件包含以下部分

要求

SDK 在 iOS 7.0 或更高版本的设备上运行。

下载 SDK

  1. (手动)

    • 从 GitHub 下载 PepperKit.embeddedframework 和依赖资源。
    • 将文件夹移动到您的项目目录中。我们通常将第三方代码放入名为 Vendor 的子目录中,因此我们将该目录移动到其中。
  2. (Cocoapods)

    • 如果尚未安装,请安装 Cocoapods
    • 将 "pod PepperKit-iOS" 添加到您的 podfile
    • 运行 pod install

设置 Xcode (如果使用 Cocoapods 则跳过此步骤)

  1. PepperKit.embeddedframework 从您的项目目录拖放到您的 Xcode 项目中。

  2. 与上述类似,我们的项目有一个名为 Vendor 的组,因此我们将它放在那里。

  3. 选择 为任何添加的文件夹创建组 并为目标设置复选标记。然后点击 完成

  4. 项目导航器 中选择您的项目(⌘+1)。

  5. 选择您的应用程序目标。

  6. 选择选项卡 编译阶段

  7. 展开 与二进制文件链接的库

  8. 如果缺失,请添加以下系统框架:

    • Accelerate
    • AssetsLibrary
    • CoreData
    • CoreGraphics
    • CoreImage
    • CoreLocation
    • Foundation
    • ImageIO
    • MapKit
    • MessageUI
    • MobileCoreServices
    • QuartzCore
    • Security
    • SystemConfiguration
    • UIKit
  9. 如果缺失,请添加以下库:

    • icucore

修改代码

Objective-C

  1. 打开你的 AppDelegate.m 文件。

  2. 在你的 #import 语句下方文件顶部添加以下行

    #import <PepperKit/PepperKit.h>
    
  3. 搜索方法 application:didFinishLaunchingWithOptions:

  4. 添加以下行以设置 PepperKit

    [PepperTalk sharedInstance].clientId = @"YOUR_CLIENT_ID";
    [PepperTalk sharedInstance].clientSecret = @"YOUR_CLIENT_SECRET";
    [[PepperTalk sharedInstance] enableInAppNotificationsInViewController:self.window.rootViewController]; //To enable in-app notifications
    
  5. 启用远程通知

    • 按照 Apple 文档中的描述启用远程通知:Apple Documentation
    • 搜索方法 application:didRegisterForRemoteNotificationsWithDeviceToken
    • 添加以下代码行
      • [PepperTalk sharedInstance].deviceToken = deviceToken;
    • 搜索方法 application:didReceiveRemoteNotification:
    • 添加以下代码行
      • [[PepperTalk sharedInstance] handleRemoteNotification:userInfo presentingViewController:self.window.rootViewController];