Questions tagged [cfstring]

Apple's suite of functions in CoreFoundation for string-handling. Toll-free bridged with NSString

107 questions
178
votes
8 answers

How to convert CFStringRef to NSString?

NSString *aNSString; CFStringRef aCFString; aCFString = CFStringCreateWithCString(NULL, [aNSString UTF8String], NSUTF8StringEncoding); aCFString = CFXMLCreateStringByUnescapingEntities(NULL, aCFString, NULL); How can I get a new NSString from…
papr
  • 4,717
  • 5
  • 30
  • 38
44
votes
5 answers

How to convert a swift String to CFString

How can i create a CFString from a native swift String or NSString in swift let path:String = NSBundle.mainBundle().pathForResource(name.stringByDeletingPathExtension, ofType:"pdf") let string:CFString = ??? path let url:CFURLRef =…
loopmasta
  • 1,693
  • 3
  • 14
  • 19
11
votes
4 answers

Convert from CFURLRef or CFStringRef to std::string

How can I convert a CFURLRef to a C++ std::string? I also can convert from the CFURLRef to a CFStringRef by: CFStringRef CFURLGetString ( CFURLRef anURL ); But now I have the same problem. How can I convert the CFStringRef to a std::string?
3ef9g
  • 781
  • 2
  • 9
  • 19
9
votes
2 answers

How to get an array of sentences using CFStringTokenizer?

I've created an string tokenizer like this: stringTokenizer = CFStringTokenizerCreate( NULL , (CFStringRef)str , CFRangeMake(0, [str length]) ,…
openfrog
  • 40,201
  • 65
  • 225
  • 373
9
votes
1 answer

[CFString release]: message sent to deallocated instance

I've been struggling with a strange problem for two days now. I went through every related question on SO but none solved the issue. I'm working on Xcode5. I'm using ARC and CoreData. On iOS7 (simulator): `[CFString release]: message sent to…
Francesco
  • 503
  • 5
  • 11
8
votes
2 answers

How do I print a CFStringRef in a DTrace action?

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…
TALlama
  • 16,017
  • 8
  • 38
  • 47
7
votes
2 answers

How to convert NSString path to CFURLRef (for iOS 3.1)?

I display a PDF in a UIScrollView. To do so I use: myDocumentRef = CGPDFDocumentCreateWithURL((CFURLRef)[[NSBundle mainBundle] URLForResource:@"salonMap" withExtension:@"pdf"]); Now, I try to make it work on an IOS 3.1 (NSBundle…
kheraud
  • 5,048
  • 7
  • 46
  • 75
5
votes
2 answers

Convert a CFStringRef to a C string?

Hello lovely computer people: I would like to convert the following CFStringRef into a CString. Any idea how? recordFilePath = (CFStringRef)[NSTemporaryDirectory() stringByAppendingPathComponent: @"recordedFile.wav"]; Thanks! EDIT 1 DarkDust…
Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
5
votes
1 answer

Cannot assign a value of type '[CFString]' to a value of type '[String]'

I just downloaded the new Xcode 7 beta 5 and I cannot find a way to resolve this error. It keeps highlighting the line "pickker.mediaTypes = [kUTTypeImage]" and says "Cannot assign a value of type '[CFString]' to a value of type '[String]'" if…
5
votes
2 answers

How to convert Unmanaged to NSString?

My application is dealing with contacts data. The phone label is retrieved as following let locPhoneLabel : NSString = (ABMultiValueCopyLabelAtIndex(phones, numberIndex) != nil) ? ABMultiValueCopyLabelAtIndex(phones,…
Colateral
  • 1,736
  • 2
  • 18
  • 22
4
votes
2 answers

CFString objects being declared by [NSBundle mainBundle]

I am working on performance improvement of my ios cocos2d game. I was checking memory allocations of the app with the help of Instruments tool when I noticed one thing. There are too many CFString objects being declared and held by [NSBundle…
Aqueel
  • 1,246
  • 3
  • 23
  • 46
4
votes
1 answer

I want to pass a variable in CFSTR?

In following coding, i want to pass variable via CFSTR, how can I ? ABMutableMultiValueRef address = ABMultiValueCreateMutable(kABDictionaryPropertyType); // Set up keys and values for the dictionary. CFStringRef keys[5]; CFStringRef…
Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154
4
votes
2 answers

CFDictionaryGetValue can't invoke with CFStringRef

I am trying to implement the CFDictionaryGetValue() as shown in this appledoc listing 3: server = CFDictionaryGetValue(credentialDict, kSecAttrServer); userName = CFDictionaryGetValue(credentialDict, kSecAttrAccount); password =…
tnek316
  • 630
  • 1
  • 5
  • 16
4
votes
2 answers

How to create a CFDictionary in an OS X target?

According to documentation CFDictionaryCreate is used to instantiate CFDictionary in swift. func CFDictionaryCreate(_ allocator: CFAllocator!, _ keys: UnsafeMutablePointer>, _ values:…
PovilasB
  • 1,488
  • 1
  • 15
  • 25
4
votes
0 answers

How to get format name from AVCaptureDeviceFormat in swift?

Here my code in objective-c for (AVCaptureDeviceFormat *format in [device formats]) { CFStringRef formatName = CMFormatDescriptionGetExtension([format formatDescription], kCMFormatDescriptionExtension_FormatName); } I need this code in…
iosLearner
  • 1,312
  • 1
  • 16
  • 30
1
2 3 4 5 6 7 8