测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布时间上次发布 | 2017年3月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Utku Yıldırım 维护。
依赖 | |
Alamofire | ~> 4.2 |
AlamofireImage | ~> 3.2 |
ObjectMapper | ~> 2.0 |
您可以在 http://www.bukoli.com 上注册 Bukoli 账户。
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。
对于 Swift 2,使用版本 0.3
https://github.com/bukoli/bukoli-ios/tree/swift2
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Bukoli', '~> 0.3'
end
然后,运行以下命令
$ pod install
您需要 API 密钥才能将 SDK 集成到您的应用程序中。您可以从 Bukoli 获取。
在 Xcode 中,右键单击您的项目 .plist 文件,然后选择“以源代码方式打开”->“作为”。在您的文件主体中插入以下 XML 片段,在最后一个元素之前。
<key>NSLocationWhenInUseUsageDescription</key>
<string>{Human readable reason for location access}</string>
AppDelegate.swift
import Bukoli
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
...
Bukoli.initialize("your api key")
..
return true
}
import Bukoli
Bukoli.sharedInstance.brandName = "Brand" // Brand Name for info dialog
Bukoli.sharedInstance.brandName2 = "Brand'den" // Ablative Brand Name for info dialog
Bukoli.sharedInstance.buttonTextColor = UIColor.white // Text Colors on button
Bukoli.sharedInstance.buttonBackgroundColor = UIColor.black // Button background color
Bukoli.sharedInstance.shouldAskPhoneNumber = true // If you want to ask user phone number for Bukoli point
SetUser 函数的第一个参数是您系统上的用户唯一标识符。Select 函数的第一个参数是 Presenter Viewcontroller。
import Bukoli
Bukoli.setUser(userCode, phone, email)
Bukoli.select(self, { (result: BukoliResult, point: BukoliPoint?, phoneNumber: String?) in
switch(result) {
case .success:
// Point selected
// If you asked for phone number, phone number is taken.
// Phone number format is: 1231234567
self.handleSuccess(point, phoneNumber)
break
case .phoneNumberMissing:
// Point selected
// User didn't give phone number.
self.handlePhoneNumberMissing(point, phoneNumber)
break
case .pointNotSelected:
// User closed without selecting a point
self.handlePointNotSelected(point, phoneNumber)
break
}
})
第一个参数是 Presenter Viewcontroller。
import Bukoli
Bukoli.info(self)
第一个参数是点代码
import Bukoli
Bukoli.pointStatus(pointCode, { (result, point) in
switch(result) {
case .enabled:
// Point is enabled
case .disabled:
// Point is disabled
case .notFound:
// Point not found
}
})
Bukoli 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。