2017-08-12 47 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)") 
     }