Ios Swift中对成员下标的引用不明确错误

Ios Swift中对成员下标的引用不明确错误,ios,swift,beacon,Ios,Swift,Beacon,我在执行CentralManagerIdentifier的可选绑定时出错, 有人能帮我吗 Swift 3.0 试试这个 var centralManager: CBCentralManager! @nonobjc func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { **if let ce

我在执行CentralManagerIdentifier的可选绑定时出错,
有人能帮我吗

Swift 3.0

试试这个

var centralManager: CBCentralManager!

@nonobjc func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    **if let centralManagerIdentifiers = launchOptions?[UIApplicationLaunchOptionsBluetoothCentralsKey]** {
        NSLog("UIApplicationLaunchOptionsBluetoothCentralsKey = \(centralManagerIdentifiers)")
    }

Swift 3.0

试试这个

var centralManager: CBCentralManager!

@nonobjc func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    **if let centralManagerIdentifiers = launchOptions?[UIApplicationLaunchOptionsBluetoothCentralsKey]** {
        NSLog("UIApplicationLaunchOptionsBluetoothCentralsKey = \(centralManagerIdentifiers)")
    }

您正在使用哪个版本的swift?它是
launchOptions?[.bluetoothCentrals]
您的方法头是以swift 2的形式编写的。不要使用
@nonobjc
隐藏警告。您需要修复Swift 3(或4?)的方法头,可能还有其他一些问题。您的问题解决了吗?谢谢!这似乎是正确的,我认为我需要使用swift 3并更改代码的其他部分。您使用的是哪个版本的swift?它是
launchOptions?[.bluetoothCentrals]
您的方法头是以swift 2的形式编写的。不要使用
@nonobjc
隐藏警告。您需要修复Swift 3(或4?)的方法头,可能还有其他一些问题。您的问题解决了吗?谢谢!这似乎是正确的,我认为我需要使用swift 3并更改代码的其他部分。