CNISDKPMSKit 4.1.37

CNISDKPMSKit 4.1.37

测试测试
语言语言 Obj-CObjective C
许可 NOASSERTION
发布最后发布2019年4月

David HennerShengHua WuVincent Jacquessonconichi iOS devsJoseph Tseng 维护。



 
依赖
CNISDKCoreKit= 4.1.37
CNISDKPaymentKit= 4.1.37
 

  • conichiGMBH

conichiSDK for iOS

Requires Carthage compatible CocoaPods Compatible Build Status

元数据

概述

conichiSDK for iOS 是一种工具,利用低功耗蓝牙(BLE)通过信标识别用户。作为一种软件即服务(SaaS)解决方案,conichi 的功能专注于个人客人的识别、快速登记、启用移动支付(从而结账)、识别个人喜好、奖励忠诚度。

套件

conichiSDK 采用将功能拆分为不同模块(所谓 套件)的理念,目前有 6 个模块可用。

  • CNISDKCoreKit - 提供信标识别、简单登记/退房以及访客个性化
  • CNISDKPaymentKit - 提供管理支付工具的抽象层,以及带支付功能的结账请求
  • CNISDKPaylevenKit - 提供通过Payleven进行支付管理的抽象层
  • CNISDKSumUpKit - 提供通过SumUp进行支付管理的抽象层
  • CNISDKGeoFencingKit - 提供基于苹果地理围栏技术的conichi会议厅跟踪功能
  • CNISDKPMSKit - 提供集成了物业管理系统的手机登记/退房功能

开始使用

安装

作为框架安装

要使用 Conichi SDK,请访问发布页面,下载 Frameworks.zip。解压ZIP文件,并将所有框架拖拽到 项目目标 -> 通用 -> 内置二进制文件 中。

Alt text

通过CocoaPods安装

通过 CocoaPods 集成 CNISDKCoreKit 是首选方法。将以下行添加到您的 Podfile

source '[email protected]:CocoaPods/Specs.git'

use_frameworks!

target 'your_tagret' do
  pod 'CNISDKCoreKit'
end

运行 pod install,现在您应该已经有了最新的 CNISDKCoreKit 发布版本。

通过Carthage安装

要通过Carthage集成 CNISDKCoreKit,请将以下行添加到您的 Cartfile

github "conichiGMBH/conichi-ios-sdk"

运行 carthage update,现在您应该在Carthage文件夹中有了最新的 CNISDKCoreKit 版本。

部分安装

以下链接可以找到 开始使用 部分中如何安装特定 套件 的说明

更新Info.plist

然后,您必须在项目中的Info.plist中添加 NSLocation 键,并包含提示用户的消息。

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>
<key>NSLocationAlwaysUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>
<key>NSLocationUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>
<key>NSLocationWhenInUseUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>

请注意,如果您决定不使用所有键,则应用可能无法正常工作。如果您想知道为什么这些键是必要的,可以查看此链接

如果您要使用我们的开发测试环境,您需要将以下行添加到您的info.plist文件中。

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
</dict>

启用某些功能

Conichi关注安全,因此SDK将授权信息存储在iOS Keychain中,但为了即使在SDK未运行的情况下也能读写值,iOS系统需要Keychain Sharing功能。

目标 -> 功能 -> Keychain Sharing - 打开开关.

Alt text

初始化

以下示例展示了指向我们开发服务器的conichiSDK CoreKit的最简单的配置。

Objective-C
  //Create a configuration for the sdk instance
  CNISDKConfiguration *configuration = [CNISDKConfiguration configurationWithBlock:^(id<CNISDKMutableConfiguration> \_Nonnull mutableConfiguration) {
    mutableConfiguration.logLevel = CNISDKLogLevelInfo;
    mutableConfiguration.apiKey = @"your-api-key";
    mutableConfiguration.apiSecret = @"your-api-secret";
    mutableConfiguration.kits = @[ ];
    mutableConfiguration.environment = CNISDKEnvironmentDevelopment;
  }];

  //Setups the sdk delegate - it can be any object that conforms to CNISDKDelegate protocol
  id<CNISDKDelegate> delegate = [self yourMethodToSetupSDKDelegate];

  //Start the sdk with the given configuration
  [CNISDK startWithConfiguration:configuration delegate:delegate];
Swift
  //Create configuration for the sdk instance
  let config: CNISDKConfiguration = CNISDKConfiguration() {
    (mutableConfig: CNISDKMutableConfiguration) in
    mutableConfig.logLevel = CNISDKLogLevel.info
    mutableConfig.apiKey = "your-api-key"
    mutableConfig.apiSecret = "your-api-secret"
    mutableConfig.kits = []
    mutableConfig.environment = CNISDKEnvironment.development
  }

  //Setups the sdk delegate - make sure that you conform to the CNISDKDelegate protocol
  let delegate: CNISDKDelegate = self

  //Start the sdk with given configuration
  CNISDK.start(with: config, delegate: delegate)

完成此配置后,您现在可以在Obj-C中使用[CNISDK sharedInstance]或者在使用Swift时使用CNISDK.sharedInstance()访问实例。

授权

要开始对访客采取任何实际动作,SDK需要访客授权。所有与授权相关的功能都在CNISDKAPIManager+Authentication分类中。以下示例展示了如何为新的访客进行注册。

Objective-C
//Create a sign up request
CNISDKSignUpRequestInfo *info = [[CNISDKSignUpRequestInfo alloc] init];
info.firstName = @"Jenessa";
info.lastName = @"Gretta";
info.email = @"[email protected]";
info.password = @"strongestpasswordever=)";

//Perform sign up
[CNISDKAPIManager manager] signUpWithRequest:info completion:^(CNISDKGuest *guest, NSError *error){
  	if (error) {
    	//handle error during the sign up
    }
    else {
     	//handle authorized guest
	}
}];
Swift
// Create a signup request
let info = CNISDKSignUpRequestInfo()
info.firstName = "Jenessa"
info.lastName = "Gretta"
info.email = "[email protected]"
info.password = "strongestpasswordever=)"

// Instantiate APImanager
let apiManager = CNISDKAPIManager()

// Perform signup
apiManager.signUp(withRequest: info) {
  	(guest, error) in
  	if let error = error {
    	//handle error during the sign up
    	return
  	}
  	//handle authorized guest
}

您也可以使用CNISDKExternalSignUpRequestInfo对象提供外部ID,而不是使用电子邮件密码的组合,并通过使用以下方式执行注册:- (void)signUpWithExternalIDRequestInfo:(CNISDKExternalSignUpRequestInfo *)requestInfo completion:(nullable CNISDKGuestErrorBlock)completion;

监控

如果访客已授权,以下代码将启用 beacon 监控

Objective-C

[[CNISDK sharedInstance] startMonitoring];

Swift

CNISDK.sharedInstance().startMonitoring()

现在,当一个访客进入conichi beacon的范围内时,应该触发以下回调

- (void)conichiSDKDidDiscoverVenue:(CNISDKVenue *)venue;

根据场景的不同,可能会调用不同的回调。所有回调都可以在CNISDKDelegate.h中找到。

Trackins

Trackins可以在用户进入特定场所的灯塔区域时由访客创建。可以通过Web API检索Trackins。

商户应用可以使用trackins来显示灯塔区域的用户列表。

以下代码演示了在发现场所后如何启动trackin:

Objective-C
- (void)conichiSDKDidDiscoverVenue:(CNISDKVenue *)venue {
	// Get the region ID
    NSString *regionID = venue.regions.firstObject.conichiID;

	// Start tracking guest in region
    [[CNISDKAPIManager manager] startTrackingGuestInRegionWithID:regionID completion:^(id trackin, NSError *error) {
        if error {
            // Handle error
        } else {
            // Do something with trackin
        }
    }];
}
Swift
func conichiSDKDidDiscover(_ venue: CNISDKVenue) {
	// Get the region ID
  	guard let regionID = currentVenue?.regions?.first?.conichiID else {
    	return
  	}

	// Instantiate API Manager if needed
	let apiManager = CNISDKAPIManager()

	// Start tracking guest in region
  	apiManager.startTrackingGuestInRegion(withID: regionID) { (trackin, error) in
 	   	if let unwrappedError = error {
    	  	// Handle error
    	} else {
      		// Do something with trackin
    	}
  	}
}

Checkins

Checkins与场所相关联。允许用户执行与场所相关的不同操作,例如支付或从场所接收消息。可以通过Web API手动创建Checkins或通过PMS集成自动创建。

Checkout requests

Checkout请求允许访客请求关闭checkin(退房)。可以带有或没有可交付的物品(如迷你吧物品等需要支付的物品)。

与checkins一样,checkouts与场所相关联。可以使用SDK创建,并使用Web API检索。

以下示例演示了如何使用CNISDKCoreKit进行针对无可交付物品的访客退房请求

Objective-C
// Get the guest's credit card
CNISDKCreditCard *creditCard = guest.creditCards.firstObject;

// Create checkout request
[[CNISDKAPIManager manager] createCheckoutRequestWithDeliverableCountableItems:nil selectedCreditCard:creditCard completion:^(id checkoutRequest, NSError *error) {
  	if (error) {
    	// Handle error
  	} else {
    	// Do something with checkoutRequest
  	}
}];
Swift
// Get the guest's credit card
let creditCard = guest.creditCards.first

// Instantiate API Manager if needed
let apiManager = CNISDKAPIManager()

// Create checkout request
apiManager.createCheckoutRequest(with: nil, selectedCreditCard: creditCard.conichiID ) { (checkoutRequest, error) in
	if error {
    	// Handle error
  	} else {
    	// Do something with checkoutRequest
  	}
}

检索访客的状态

您可以使用以下代码从conichi的云中检索访客。

Objective-C
// Fetch guest status
[[CNISDK sharedInstance] fetchGuestStatus];
// Implement delegate method of CNISDKDelegate
- (void)conichiSDKDidUpdateGuestStatus:(CNISDKGuest *)guest {
    // do something with guest
}
Swift
// Fetch guest status
CNISDK.sharedInstance().fetchGuestStatus()
// Implement delegate method of CNISDKDelegate
func conichiSDKDidUpdateGuestStatus(_ guest: CNISDKGuest) {
	// do something with guest
}

注意

虽然上述文档应该足以帮助您入门,但这仅涵盖了SDK功能的一小部分。如果您对其使用有任何疑问,请随时联系我们。


文档

每个套件的文档可以在以下链接中找到

推送通知集成的文档可以在这里找到

变更日志

要查看conichiSDK最近版本的更改,请查阅变更日志

许可

Copyright (c) 2016-present, сonichi GmbH.
All rights reserved.