NSString *aNSString;
CFStringRef aCFString;
aCFString = CFStringCreateWithCString(NULL, [aNSString UTF8String], NSUTF8StringEncoding);
aCFString = CFXMLCreateStringByUnescapingEntities(NULL, aCFString, NULL);
How can I get a new NSString from aCFString?
...
Is there a way to get the length in bytes of a CFString given an arbitrary character encoding? It seems possible because the function CFStringGetSmallestEncoding must do some calculations already, but I don't want to use the smallest encoding, I want to find out how big a buffer I might need to allocate if I want the bytes in UTF-8 encod...
I have a DTrace probe catching calls to a function, and one of the function's arguments is a CFStringRef. This is private structure that holds a pointer to a unicode string. But the CFStringRef is not itself a char*, so normal DTrace methods like copyinstr() just return ?cp?, which isn't exactly helpful.
So how can I print out the strin...
I'm trying to get the hang of using JNA with Mac OS X. I want to access a Carbon library, for which there is no Cocoa equivalent, so Rococoa can't help me (I think...)
I'm stuck when trying to call a Carbon function that requires CFStringRef as a parameter. How can I create a CFStringRef from a Java String?
Here's my attempt so far:
...
I am attempting to create a Cocoa Framework that is an object-oriented wrapper around a procedural framework written in the Core Foundation. The procedural framework has a number of constants that are all defined as extern CFStringRef constantName.
How should I create NSString constants that directly map to the procedural constants so t...
Hello,
I have static NSString as below:
static NSString *bowlerName;
In the code I am assigning it with some value as below:
-(void)setBowlerSpecifications:(int)playerId
{
Player *objPlayer = [CricketManagementDAL getBowlerSpecification :playerId];
[objPlayer retain];
bowlerSpecialSkill = objPlayer.specialSkill;
bowlerT...
The below example should work with Unicode strings but it doesn't.
CFStringRef aString = CFSTR("one"); // in real life this is an Unicode string
CFStringRef formatString = CFSTR("This is %s example"); // also tried %S but without success
CFStringRef resultString = CFStringCreateWithFormat(NULL, NULL, formatString, aString);
// Here I...
ParamText() is an really old way of replacing parameters in a string that is based on Pascal strings. Also StandardAlert is not quite Unicode ready.
The new message box (not so new) replacement is CFUserNotificationDisplayNotice but this one expects CFString and I found out that if I'm about to switch to using CFString I'm not able to u...
While running Instruments to find leaks in my code, after I've loaded a file and populate an NSMutableArray with new objects, leaks pop up! I am correctly releasing the objects. Sample code below:
//NSMutableArray declared as a retained property in the parent class
if(!mutableArray)
mutableArray = [[NSMutableArray alloc] initWi...
Hi all,
i shortly started Programming Mac OS X Applications with Cocoa, so its a realy New bee question. Sorry about this.
At first my code snippet:
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
Purchaser *actPurchaser = [tableViewDataArray objectAtIndex:row]...