gpt4 book ai didi

ios - 位置管理器代理出现错误

转载 作者:行者123 更新时间:2023-11-29 01:17:29 25 4
gpt4 key购买 nike

我正在尝试使用我从

获得的代码 https://github.com/Intermark/Buoy/tree/master/Buoy/Swift

我在 BUOYListener.swift 中收到以下错误,在此处输入代码BUOYBeacon.swift

知道如何解决这个问题吗?

enter image description here enter image description here

最佳答案

从 Swift 2.0 开始,Swift 编译器要求方法签名与您正在实现的协议(protocol)严格匹配。在这种情况下,这是 CLLocationManagerDelegate 和 CBPeripheralManagerDelegate。

didRangeBeacons 的正确 Swift 签名是:

func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion)

对于peripheralManagerDidUpdateState:

func peripheralManagerDidUpdateState(peripheral: CBPeripheralManager)

最后,startAdvertising 需要一个 [String: AnyObject] 字典,但您要将 peripheralData 转换为 [NSObject:任何对象]。请改用以下转换:

self.beaconRegion.peripheralDataWithMeasuredPower(nil) as! [String: AnyObject]

关于ios - 位置管理器代理出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34983684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com