English 中文(简体)
职能要求 CFURLCreateStringByAddingPercentE die a Core Foundation Object with a +1 版权
原标题:Call to function CFURLCreateStringByAddingPercentEscapes returns a Core Foundation object with a +1 retain count

我将我的项目转换为ARC和X密码,认为这里有传闻,任何人都看不出有任何错误。 我没有写这部法典,因此我不熟悉C电话。

- (NSString*) URLEscaped
{

    NSString *encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(
                                NULL,
                                (CFStringRef)self,
                                NULL,
                                (CFStringRef)@"!* ();:@&=+$,/?%#[]",
                                kCFStringEncodingUTF8);

    return encodedString;

}
最佳回答

From the docs:

There are many ways in which you can get a reference to an object using Core Foundation. In line with the Core Foundation ownership policy, you need to know whether or not you own an object returned by a function so that you know what action to take with respect to memory management. Core Foundation has established a naming convention for its functions that allows you to determine whether or not you own an object returned by a function. In brief, if a function name contains the word "Create" or "Copy", you own the object. If a function name contains the word "Get", you do not own the object.

是的,你重新贴出CFString

问题回答

在阿农发中心之下,你可以利用“桥梁”向阿农发中心转移遗体的记忆管理:

NSString *encodedString = (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(
                            NULL,
                            (CFStringRef)self,
                            NULL,
                            (CFStringRef)@"!* ();:@&=+$,/?%#[]",
                            kCFStringEncodingUTF8);




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签