let region = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: "(the appropriate UUID for my beacons)", identifier: "Estimotes")
我项目中的上述代码行给了我一个错误说明:
init(UUIDString;)' 已重命名为 'init(uuidString:)'
有什么解决办法吗?
在 Swift 3.0 中,“UUIDString”被更改为“uuidString”。在您的信标的唯一 UUID 之后,您必须插入“as!UUID”。所以,你必须像这样改变你的让:
让 region = CLBeaconRegion(proximityUUID: NSUUID(uuidString: "79A60506-EC33-44A4-AB5D-304816FEC4E2") as! UUID, identifier: "Estimates")
原始答案: LocationManager 的区域
您需要解开proximityUUID 提供的NSUUID
let beaconUUID = knownBeacons[i].proximityUUID!.UUIDString
let region = CLBeaconRegion(proximityUUID: beaconUUID, identifier: "Estimotes")
也许这是一个错字,但显示的代码:
let region = CLBeaconRegion(proximityUUID:
NSUUID(UUIDString: "(the appropriate UUID for my beacons)", identifier: "Estimotes")
在 NSUUID 初始化程序之后缺少关闭 )。它应该如下所示:
let region = CLBeaconRegion(proximityUUID:
NSUUID(UUIDString: "(the appropriate UUID for my beacons)"), identifier: "Estimotes")