Sending a message to a Toll free bridge
Sending a message to a Toll free bridge
- Subject: Sending a message to a Toll free bridge
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 25 Nov 2013 16:23:47 +0700
The documentation states: "CFArray is “toll-free bridged” with its Cocoa Foundation counterpart, NSArray. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an NSArray * parameter, you can pass in a CFArrayRef"
Does this also mean: "any message you can send to an NSArray, you can send also to an CFArrayRef"?
NSFont *fo = [ NSFont fontWithName: @"Thonburi" size: 0 ];
CTFontRef font = (__bridge CTFontRef)fo;
CFArrayRef tags = CTFontCopyAvailableTables ( font, 0 );
NSArray *tagsArray = CFBridgingRelease(tags);
// next line prints: class __NSCFArray count: 18
NSLog(@"%s class %@ count: %lu",__FUNCTION__, [tagsArray class], [tagsArray count]);
So sending messages to an CFArrayRef seems to be ok. Or not?
But then this line crashes:
NSString *tagDescription = [ tagsArray description ];
My mistake? My false assumption?
Gerriet.
_______________________________________________
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