草庐IT

CFStringRef

全部标签

swift - Swift 中的 UTTypeCreatePreferredIdentifierForTag 和 CFStringRef

importFoundationimportMobileCoreServicesfunccheckFileExtension(fileName:NSString){println(fileName)varfileExtension:CFStringRef=fileName.pathExtensionprintln(fileExtension)varfileUTI:CFStringRef=UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,fileExtension,nil)println(fileUTI)

objective-c - 使用 LLVM GCC 4.2 不会让我将 CFStringRef _bridge 成 NSString

我需要在我的iPad应用程序中绘制一些图表,所以我遵循了本教程:http://recycled-parts.blogspot.com/2011/07/setting-up-coreplot-in-xcode-4.html其中我不得不将我的C/C++/Objective-C编译器更改为LLVMGCC4.2。(最初是AppleLLVMCompiler3.0)。现在,我无法将CFStringRef_bridge转换为NSString。我收到以下错误:'_bridge'undeclared(firstuseinafunction)谁能帮我解决这个问题??谢谢。 最佳

objective-c - 将 Objective-C 指针类型 'NSString *' 转换为 C 指针类型 'CFStringRef'(又名 'const struct __CFString *')需要桥接转换

将Objective-C程序转换为Objective-CARC时,出现错误:"castofObjective-Cpointertype'NSString*'toCpointertype'CFStringRef'(aka'conststruct__CFString*')requiresabridgedcast"代码如下:-(NSString*)_encodeString:(NSString*)string{NSString*result=(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)string,

ios - CFDictionaryGetValue 无法使用 CFStringRef 调用

我正在尝试实现CFDictionaryGetValue(),如thisappledoc中所示list3:server=CFDictionaryGetValue(credentialDict,kSecAttrServer);userName=CFDictionaryGetValue(credentialDict,kSecAttrAccount);password=CFDictionaryGetValue(credentialDict,kSecSharedPassword);我是这样实现的letuserName=CFDictionaryGetValue(credentialDict,kSe

swift - 在 Swift 中,如何将 CFStringRef[] 和 CFTypeRef[] 转换为 CMutablePointer< COpaquePointer >?

在Swift中我如何转换CFStringRef[]和CFTypeRef[]至CMutablePointer?我想调用CFDictionaryCreate来自swift。我已经定义:varkeys:CFStringRef[]=[kCGImageSourceCreateThumbnailWithTransform,kCGImageSourceCreateThumbnailFromImageIfAbsent,kCGImageSourceThumbnailMaxPixelSize,kCGImageSourceCreateThumbnailFromImageAlways]varvalues:CF

objective-c - NSString 到 CFStringRef 和 CFStringRef 到 ARC 中的 NSString?

我想了解从ARC中的CFStringRef获取NSString的正确方法?反方向也一样,ARC中的CFStringRef到NSString?在不造成内存泄漏的情况下,正确的方法是什么? 最佳答案 通常NSString*yourFriendlyNSString=(__bridgeNSString*)yourFriendlyCFString;和CFStringRefyourFriendlyCFString=(__bridgeCFStringRef)yourFriendlyNSString;现在,如果你想知道为什么会有__bridge关键

objective-c - 将 Objective-C 指针类型 'NSString *' 转换为 C 指针类型 'CFStringRef' (又名 'const struct __CFString *' )需要桥接转换

将Objective-C程序转换为Objective-CARC时,出现错误:"castofObjective-Cpointertype'NSString*'toCpointertype'CFStringRef'(aka'conststruct__CFString*')requiresabridgedcast"代码如下:-(NSString*)_encodeString:(NSString*)string{NSString*result=(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)string,

objective-c - 将 Objective-C 指针类型 'NSString *' 转换为 C 指针类型 'CFStringRef' (又名 'const struct __CFString *' )需要桥接转换

将Objective-C程序转换为Objective-CARC时,出现错误:"castofObjective-Cpointertype'NSString*'toCpointertype'CFStringRef'(aka'conststruct__CFString*')requiresabridgedcast"代码如下:-(NSString*)_encodeString:(NSString*)string{NSString*result=(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)string,
12