• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trouble scanning for peripherals - iOS 8 + Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble scanning for peripherals - iOS 8 + Swift


  • Subject: Re: Trouble scanning for peripherals - iOS 8 + Swift
  • From: Peter Watkins <email@hidden>
  • Date: Thu, 25 Sep 2014 20:59:41 -0700

That's it! Thanks! I'm not sure how I missed that. 

On Thu, Sep 25, 2014 at 8:51 PM, Christopher Cotton <email@hidden> wrote:
that works. I just took your view controller and changed that one function.



On Thu, Sep 25, 2014 at 10:49 PM, Christopher Cotton
<email@hidden> wrote:
> I think the function should be:
>
>     func centralManager(central: CBCentralManager!,
> didDiscoverPeripheral peripheral: CBPeripheral!, advertisementData:
> [NSObject : AnyObject]!, RSSI: NSNumber!) {
>
>
>
>     }
>
>
>
>
>
> On Thu, Sep 25, 2014 at 10:26 PM, Peter Watkins <email@hidden> wrote:
>> I wrote a dirt-simple single view app to scan for peripherals and NSLog
>> them. LightBlue sees the peripheral, by the way. This is on an iPhone 5s
>> running iOS 8.0.
>>
>> CoreBluetooth goes to the PowerOn state and start the scan, but
>> didDiscoverPeripheral is never called. Everything is in my view controller,
>> so here's the entire code: Any idea why didDiscoverPeripheral is never
>> called? Did I miss something obvious?
>>
>> import UIKit
>>
>> import CoreBluetooth
>>
>>
>> class ViewController: UIViewController, CBCentralManagerDelegate {
>>
>>
>>
>>     var centralManager: CBCentralManager!
>>
>>
>>     override func viewDidLoad() {
>>
>>         super.viewDidLoad()
>>
>>         // Do any additional setup after loading the view, typically from a
>> nib.
>>
>>
>>
>>         self.centralManager = CBCentralManager(delegate:self, queue:nil)
>>
>>     }
>>
>>
>>
>>     func centralManagerDidUpdateState(central: CBCentralManager!) {
>>
>>         NSLog("\(central.state)");
>>
>>
>>
>>         if (central.state == CBCentralManagerState.PoweredOn) {
>>
>>             centralManager.scanForPeripheralsWithServices(nil,
>> options:[CBCentralManagerScanOptionAllowDuplicatesKey:true])
>>
>>         }
>>
>>     }
>>
>>
>>
>>     func didDiscoverPeripheral(peripheral: CBPeripheral!, advertisementData:
>> [NSObject : AnyObject]!, RSSI: NSNumber!) {
>>
>>         NSLog("Discovered \(peripheral.description)")
>>
>>     }
>>
>>
>>     override func didReceiveMemoryWarning() {
>>
>>         super.didReceiveMemoryWarning()
>>
>>         // Dispose of any resources that can be recreated.
>>
>>     }
>>
>> }
>>
>>
>> Thanks,
>>
>> Peter
>>
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Bluetooth-dev mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
>
> --
> Christopher



--
Christopher

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Trouble scanning for peripherals - iOS 8 + Swift (From: Peter Watkins <email@hidden>)

  • Prev by Date: Re: Trouble scanning for peripherals - iOS 8 + Swift
  • Previous by thread: Re: Trouble scanning for peripherals - iOS 8 + Swift
  • Index(es):
    • Date
    • Thread