Re: Detecting iPods
Re: Detecting iPods
- Subject: Re: Detecting iPods
- From: email@hidden
- Date: Mon, 26 Dec 2005 21:04:33 -0500
A common way you'll see if to check for the "iPod_Control" directory.
Here's an example that should get you started:
- (NSArray*)connectediPods {
NSArray* allVolumes = [[NSWorkspace sharedWorkspace]
mountedRemovableMedia];
NSMutableArray* iPodVolumes = [[NSMutableArray alloc] init];
int i;
for (i=0;i<[allVolumes count];i++)
{
NSString* iPodControlPath = [[allVolumes objectAtIndex:i]
stringByAppendingPathComponent:@"iPod_Control"];
if ([[NSFileManager defaultManager]
fileExistsAtPath:iPodControlPath])
{
[iPodVolumes addObject:[allVolumes objectAtIndex:i]];
}
}
[iPodVolumes autorelease];
return iPodVolumes;
}
- (BOOL)deviceIsiPodAtPath:(NSString*) path {
return [[NSFileManager defaultManager] fileExistsAtPath:
[path stringByAppendingPathComponent:@"iPod_Control"]];
}
On Dec 26, 2005, at 8:54 PM, Eamon Ford wrote:
How do I tell if an iPod is mounted? I know I'd use NSWorkspace's
mountedRemovableMedia method, but how do I tell if the device
attached is an iPod?
Thanks,
Eamon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
M.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden