Questions tagged [cfstring]

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

107 questions
2
votes
3 answers

release CFString

I use this code to get the last name of ABPerson CFStringRef lastNameRef = ABRecordCopyValue((ABRecordRef)personRecordRef, kABPersonLastNameProperty); NSString *friendLastName = (NSString*)lastNameRef; CFRelease(lastNameRef); it work fine when the…
iArezki
  • 1,273
  • 2
  • 17
  • 29
1
vote
3 answers

Convert CFStringRef to QString

cross platform c++ header file. separate c++ file for each platform: windows, linux, mac. Deals with platform specific implementation of enumerating windows. on the mac side: I have a CFStringRef populated. the header file defines a QString object.…
JasonGenX
  • 4,952
  • 27
  • 106
  • 198
1
vote
1 answer

How to get a specific attribute from a CFString

I want to know whether a string is single-byte encoding. The CFShowStr can do this work, but it output the message to the console. The CFShowStr function output message is look like this, the IsEightBit item is what I want: Length 7 IsEightBit 1…
magiclyx
  • 63
  • 5
1
vote
1 answer

URL encode string in ios failing

I am trying to url encode a string in my iOS 5 app using ARC. This is how i do it: - (NSString *)escape:(NSString *)text { return (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, …
Rickard Liljeberg
  • 966
  • 1
  • 12
  • 39
1
vote
0 answers

-[CFString hash]: message sent to deallocated instance

I'm trying to fetch EKEvents from the Event Store to populate a UITableView and display a month list view. Basically it works and I'm doing it like this: - (void) reloadEvents { for ( NSString *entry in self.calendarA ) { …
1
vote
1 answer

Get a calculated length of a Core Foundation string given an encoding

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…
dreamlax
  • 93,976
  • 29
  • 161
  • 209
1
vote
1 answer

CFData vs CFString

I have a CFMutableDictionaryRef, part of which in debugger is: "device-id" = <72270000>; model = <474d4120 39353000>; "vendor-id" = <86800000>; Now I can get value of the key model using CFDataRef which returns string like "GMA 950", as…
yolo
  • 2,757
  • 6
  • 36
  • 65
1
vote
1 answer

CFStringRef setting a value to ""

I have a variable which is a CFStringRef and I perform a check to make sure its not 1 specific value. If it is then I want to set it to the NSString equivalent of @"" Here's the code CFStringRef data = = CFDictionaryGetValue(dict,…
Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177
1
vote
1 answer

How to properly use CFStringGetCString in swift?

I am looking at the docs for CFStringGetCString and AXUIElementCopyAttributeValue. CFStringGetCString takes the param buffer: UnsafeMutablePointer! AXUIElementCopyAttributeValue takes the param value: UnsafeMutablePointer For the…
Dave Stein
  • 8,653
  • 13
  • 56
  • 104
1
vote
0 answers

OBJ-C wiping NSString with CFStringGetCStringPtr not working because not finding the right encoding

I'm need to wipe an NSString (It is an existing SKD that I will probably wont be able to change method signatures in as clients are working with it already. For Security reasons that emerged right now we Need to wipe the bytes in the NSStrings we…
Erez
  • 1,933
  • 5
  • 29
  • 56
1
vote
1 answer

How to test UIImagePickerControllerMediaType for kUTTypeImage?

In the delegate method of UIImagePickerViewController, I want to test for the media type. This worked in Swift 3: switch info[UIImagePickerControllerMediaType] as? NSString { case .some(kUTTypeImage): //... } But in Swift 4, it throws an…
1
vote
0 answers

Swift Array of strings to UnsafeMutablePointer>!

I am trying to call DADiskMountWithArguments using Swift. swiftfunc DADiskMountWithArguments(_ disk: DADisk, _ path: CFURL?, _ options: DADiskMountOptions, _ callback: DADiskMountCallback?, _ context: UnsafeMutableRawPointer?, _ arguments:…
1
vote
2 answers

CFString release, why only on ipad?

I have the same project, that at the beginning, it worked also on ipad, but now it works only on iphone devices, not ipad ones. It's a project iphone/ipad compatibile. Probably i edit something but i don't know how! The returned error in DEBUG ||…
elp
  • 8,021
  • 7
  • 61
  • 120
1
vote
0 answers

Localization in Pinyin with the tone marks

I am creating an iOS application in which there is a localisation of Pinyin Language. The issue seems to be that I am not getting the perfect translated word like Google Translate is giving. I am using this piece of code to translate the Chinese…
Gaurang
  • 405
  • 2
  • 4
  • 16
1
vote
0 answers

Saving a custom label (CFStringRef) for contacts always reverts text "Home"

When saving phone number "tecnical" as a custom label to Contacts with ABRecord, the label for "technical" reverts to label "home" when viewed in contacts. Everything else saves as expected. The preview shows correct string "technical" but then…
JSA986
  • 5,870
  • 9
  • 45
  • 91