LineableLibrary 0.0.2

LineableLibrary 0.0.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新版本发布时间2016年3月
SPM支持 SPM

Doheny Yoon 维护。



LineableLibrary

用法

要运行示例项目,克隆仓库,然后首先从 Example 目录运行 pod install

功能

初始化

import LineableLibrary

class YourClass:UIViewController, LineableDetectorDelegate {

    let lineableDetector = LineableDetector.sharedDetector

    func viewDidLoad() {
        /*
        *  Customize Detecting Options. If DetectInterval and BackgroundMode is nil, it sets to default values. Delegate and apikey is required.
        */
        self.lineableDetector.setup(delegate: self, apiKey: "YOUR_API_KEY_HERE", detectInterval: 10.0, backgroundModeEnabled: nil)

        /*
        * Starts Tracking
        */
        self.lineableDetector.startTracking()
    }

}

您只需要添加 LineableDetectorDelegate 并初始化。您还可以设置检测时间和是否在应用程序进入后台时进行检测。

不要忘记实现代理方法。

代理回调

func didStartRangingLineables() // Callbacks when tracking starts
func didStopRangingLineables() // Callbacks when tracking stops

func willDetectLineables() // Callbacks just before the detector prepares to send data to server.
func didDetectLineables(numberOfLineablesDetected:Int, missingLineable:MissingLineable?) // Callbacks when the Library Detects nearby Lineables via bluetooth. MissingLineable will have a value when there is a reported Lineable nearby. See below for more details about MissingLineable.
func didFailDetectingLineables(error:LineableDetectorError) // Callbacks when an error occurs while detecting

缺少 Lineable

var seq:Int { get } // Unique Identifier
var name:String { get set } // Name of the Missing Lineable
var lineableDescription:String? { get set } // Description of the Missing Lineable
var photoUrls:[String] { get set } // Photo URLs of the Missing Lineable. Always has atleast one value. There can be up to 3 values.
var reporterName:String? { get set } // The person who reported this Lineable Missing
var reporterPhoneNumber:String? { get set } // The phone number of the reporter. You can use this to call the protector when the Missing Lineable is found.
var reportedDate:NSDate? { get set } // The date when reported.

要求

兼容 iOS 8.1 或更高版本。如果您想在 Objective-C 中实现,请在此处查看 Objective-C 示例 在这里

安装

LineableLibrary 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "LineableLibrary"

如果您的应用程序支持 iOS9.0 或更高版本,您需要在 Xcode 中添加对后台位置服务的支持。此外,您还需要在您的 Info.plist 中添加 NSApptransportSecurity 参数。 *

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

有关说明,请参阅 stackoverflow 上的绝佳答案 在此

作者

Doheny Yoon, [email protected]

许可证

LineableLibrary 根据 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。