Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8850835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:59:31+00:00 2026-06-14T12:59:31+00:00

I am trying to connect automatically to a bluetooth device. The first time, a

  • 0

I am trying to connect automatically to a bluetooth device. The first time, a user has to select the device through the IOBluetoothDeviceSelectorController. This address is then stored somewhere and afterwards, this device should connect automatically.

The idea I had was to step through all known and paired Bluetooth devices using pairedDevices and then break when the device address equals the previous address. But for some reason I cannot get this break to happen.

This is my (somewhat shortened) code:

IOBluetoothDevice *device;
NSArray *devices = [IOBluetoothDevice pairedDevices];
NSEnumerator *e = [devices objectEnumerator];
NSString *mytempstring, *mytempstring2 = @"AA";

while (device = [e nextObject])
{
    NSLog(@"=%@=", [device addressString]);
    mytempstring = [device addressString];
    NSLog(@"=%@=", mytempstring);
    if (mytempstring == @"00-80-25-15-29-20")
    {
        break;
    }
    if (mytempstring2 == @"AA")
    {
        break;
    }
}

The log window output is as follows:

2012-11-18 00:06:02.385 Program[5093:303] =00-80-25-15-29-20=

2012-11-18 00:06:04.772 Program[5093:303] =00-80-25-15-29-20=

The outputs clearly match, but for some reason the if statement thinks otherwise and the break is never executed. I have added a second if statement for checking, and this one does execute as expected and initiates the second break…

Any thoughts why the address string compare does not work?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:59:32+00:00Added an answer on June 14, 2026 at 12:59 pm

    I solved it by replacing the “==” satement with the “isEqualToString” statement…

    IOBluetoothDevice *device;
    NSArray *devices = [IOBluetoothDevice pairedDevices];
    NSEnumerator *e = [devices objectEnumerator];
    
    while (device = [e nextObject])
    {
        if ([[device addressString] isEqualToString:@"00-80-25-15-29-20"])
        {
            break;
        }
    }
    

    Thanks for looking into it anyway!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam trying to connect my android device with a bluetooth compatible device. I know
I am trying to connect the JSF to database. This are the files web.xml
I'm using django-registration and I'm trying to connect to its signals to automatically create
I am trying to debug a WCF service. This client has been able to
So I am trying to connect to my company's website through an HTTP authentication
Basically...... I am trying to connect to a device over a TCP/IP connection. I
Im trying to connect my project via sFTP. and everytime I run the project
Im trying to connect MySql from VB.NET in visual basic 2010. I wanted to
I trying to connect to a Java Service with some special security requirements It
I am trying to connect to a Servlet with my j2me application and it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.