Question on interchangeability of CFString and NSString ( both core foundation )
Quote from Forum Archives on February 18, 2010, 12:57 pmPosted by: fbcocoa.bw <fbcocoa.bw@...>
On 18 Feb 2010, at 17:38, Brian S wrote:> Hi Guys,
>
> Apple docs tell us these are toll-free bridged, so where NSString is shown in a method call a CFString may be substituted and vice-versa. That I understand.
>
> My question is: Can a CF function ( using CFStringCreateWithFormat as a point of discussion - but could be any CF call ) be used successfully in Objective-C code ( or code that is compiled with the Cocoa framework - i.e. #import ) instead of the NSString method ( in this case stringWithFormat: )?
>
> I'm hoping someone knows the answer without doing research ( because I can do that ). It seems that Cocoa often calls through to lower levels of Foundation code that are CF calls, so I thought CF calls might possibly be recognized ( and not reported as "undefined" by the compiler).
>Yes.
Bernie
Posted by: fbcocoa.bw <fbcocoa.bw@...>
> Hi Guys,
>
> Apple docs tell us these are toll-free bridged, so where NSString is shown in a method call a CFString may be substituted and vice-versa. That I understand.
>
> My question is: Can a CF function ( using CFStringCreateWithFormat as a point of discussion - but could be any CF call ) be used successfully in Objective-C code ( or code that is compiled with the Cocoa framework - i.e. #import ) instead of the NSString method ( in this case stringWithFormat: )?
>
> I'm hoping someone knows the answer without doing research ( because I can do that ). It seems that Cocoa often calls through to lower levels of Foundation code that are CF calls, so I thought CF calls might possibly be recognized ( and not reported as "undefined" by the compiler).
>
Yes.
Bernie