title: Connect automatically to a Bluetooth device through pairedDevices
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>This is my (somewhat shortened) code:</p>
  
  <pre><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;
      }
  }
  </code></pre>
  
  <p>The log window output is as follows:</p>
  
  <p>2012-11-18 00:06:02.385 Program[5093:303] =00-80-25-15-29-20=</p>
  
  <p>2012-11-18 00:06:04.772 Program[5093:303] =00-80-25-15-29-20=</p>
  
  <p>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...</p>
  
  <p>Any thoughts why the address string compare does not work?</p>
  
  <p>Thanks in advance!</p>