Hello all, I've been going through the SpeakHere sample code from the iPhone SDK and trying to repurpose some of the code for what I'm working on.
I ran into something I don't quite understand and was hoping to get some enlightenment. There's a method defined on AudioPlayer that goes like this: - (id) initWithURL: (CFURLRef) fileURL; In the code I'm using to call it I have the following: NSString *thePath = [[NSBundle mainBundle] pathForResource:@"MySound" ofType:@"aiff"]; CFURLRef fileURL = CFURLCreateWithFileSystemPath ( NULL, (CFStringRef) thePath, kCFURLPOSIXPathStyle, false ); AudioPlayer *thePlayer = [[AudioPlayer alloc] initWithURL: (NSURL *)fileURL]; The question I have is on the line: AudioPlayer *thePlayer = [[AudioPlayer alloc] initWithURL: (NSURL *)fileURL]; Why does fileURL have to be cast to NSURL * when initWithURL wants a CFURLRef? Without that cast, I get a compile error about incompatible types. It appears the reason for the CFURLRef is that's what the lower level Sound Toolbox calls need, but why all the casting at the higher levels when it could just be a NSURL until the time when the toll free bridge cast to CFURLRef is needed for those calls? Any insight would be greatly appreciated. Thanks, Patrick _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com