Re: Sending a message to a Toll free bridge
Re: Sending a message to a Toll free bridge
- Subject: Re: Sending a message to a Toll free bridge
- From: "Stephen J. Butler" <email@hidden>
- Date: Mon, 25 Nov 2013 03:54:40 -0600
I don't believe that the array that CTFontCopyAvailableTables() returns
contains CFTypes. So yes, CFArray is bridgeable. But in this case that
isn't so useful since the values aren't.
On Mon, Nov 25, 2013 at 3:23 AM, Gerriet M. Denkmann
<email@hidden>wrote:
> 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
_______________________________________________
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