• 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: Retrieve peripheral and connect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Retrieve peripheral and connect


  • Subject: RE: Retrieve peripheral and connect
  • From: Andrew Coad <email@hidden>
  • Date: Tue, 10 Nov 2015 09:00:07 -0500
  • Importance: Normal
  • X_v_e_cd: 158f6e0c26bf6d786bd74aa90f82633b
  • X_v_r_cd: f0e8f066fb17400e70975018da2c153a

Hi Janis,

Set the delegate for the peripheral before you call [central connectPeripheral....]

Even though you retrieved the peripheral, it no longer has a delegate....

REgards,

Andrew Coad


To: email@hidden
From: email@hidden
Subject: Retrieve peripheral and connect
Date: Fri, 2 Oct 2015 11:21:53 +0000

Hello!

I have an issue with retrieving peripheral and then connect to device. I successfully retrieve peripheral with given UUID and then try to connect, but device just doesn't connect. After  [central connectPeripheral:peripheral options:nil]; state status becomes ' state = connecting>' and nothing happens. Maybe someone has experience with this problem( I am working first time with peripheral retrieving)? Thank you!
p.s. when I scan peripherals and connect then everything works perfect and my iPhone connects without problems .

Code looks like this:

- (void)retrievePeripheral:(NSString *)uuidString central:(CBCentralManager *)central

{

    NSUUID *nsUUID = [[NSUUID UUID] initWithUUIDString:uuidString];

    NSLog(@"%@", nsUUID);

    if(nsUUID)

    {

        NSArray *peripheralArray = [self.centralManager retrievePeripheralsWithIdentifiers:@[nsUUID]];

        // Check for known Peripherals

        if([peripheralArray count] > 0)

        {

            for(CBPeripheral *peripheral in peripheralArray)

            {

                NSLog(@"Connecting to Peripheral - %@", peripheral);

                [central connectPeripheral:peripheral options:nil];

                NSLog(@"Connecting to Peripheral - %@", peripheral);

                [central connectPeripheral:peripheral options:nil];

            }

        }

}


_______________________________________________ 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
 _______________________________________________
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

  • Prev by Date: Re: Peripheral not being discovered in the background until I open the BlueTooth Settings page
  • Next by Date: Re: Peripheral not being discovered in the background until I open the BlueTooth Settings page
  • Previous by thread: Re: Peripheral not being discovered in the background until I open the BlueTooth Settings page
  • Next by thread: Read/Write a long data
  • Index(es):
    • Date
    • Thread