Re: Simple Bluetooth Question
Re: Simple Bluetooth Question
- Subject: Re: Simple Bluetooth Question
- From: Alain Schartz <email@hidden>
- Date: Thu, 26 Jul 2007 01:03:26 -0700
I don't see anything wrong with your use of NSArray.
Are you sure that you have some paired devices on your system (check this in your Bluetooth preferences, under "Devices" , paired devices show up in the upper table view). If not, use the "Set up new device" button to set up some paired device, then try again.
Alain
On Thursday, July 26, 2007, at 12:13AM, "Patrick Walker" <email@hidden> wrote:
>First, I'm a ME student, not a CS student. I've really only started
>using Xcode since the beginning of the year and can write GUI apps
>but they're boring and rather useless for me.
>
>I'm just futzing around with BT for a bit and wondering why I'm not
>getting any results when asking for paired devices. The result is
>always nil for any of the class (+) methods. I know there is an
>autorelease error but I'm not concerned about that atm. Am I using
>NSArray properly?
>
>#import <Cocoa/Cocoa.h>
>#import <IOBluetooth/objc/IOBluetoothDevice.h>
>
>int main(int argc, char *argv[])
>{
> NSArray * btfav = [NSArray arrayWithArray:[IOBluetoothDevice
>pairedDevices]];
>
> NSLog(@"Size of array: %i", [btfav count]);
>
> if ([IOBluetoothDevice pairedDevices] == nil)
> NSLog(@"Nothing in pairedDevices");
> else
> NSLog(@"Something in pairedDevices");
>
> if ([IOBluetoothDevice favoriteDevices] == nil)
> NSLog(@"Nothing in favoriteDevices");
> else
> NSLog(@"Something in favoriteDevices");
>
> return 0;
>}
>
>Output:
>
>2007-07-25 18:55:41.548 Bluetooth[2437] Size of array: 0
>2007-07-25 18:55:41.549 Bluetooth[2437] Nothing in pairedDevices
>2007-07-25 18:55:41.549 Bluetooth[2437] Nothing in favoriteDevices
>
>
>____________________________________
>
>Patrick Walker
>email@hidden
>email@hidden
>email@hidden
>
>
>
>_______________________________________________
>
>Cocoa-dev mailing list (email@hidden)
>
>Please do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>
>This email sent to email@hidden
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden