2017-08-12 61 views
1
var centralManager: CBCentralManager! 

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

我得到一个错误,我做CentralManagerIdentifiers的可选结合, 谁能帮助我?暧昧参考成员标误差在斯威夫特

+0

您正在使用哪个版本的swift? – Jaydeep

+0

它是'launchOptions?[。bluetoothCentrals]' – Lamar

+1

您的方法头以Swift 2的形式编写。不要用'@ nonobjc'隐藏警告。您需要修复Swift 3(或4?)的方法头,并且可能还有其他一些东西。 – OOPer

回答

0

雨燕3.0

试试这个。

if let centralManagerIdentifiers = launchOptions?[UIApplicationLaunchOptionsKey.bluetoothCentrals] { 
      NSLog("UIApplicationLaunchOptionsBluetoothCentralsKey = \(centralManagerIdentifiers)") 
     }