iphone - CFHTTPCookieGetCreateDate 在此操作系统版本 (iOS4) 中已弃用

标签 iphone cookies ios4 nsurlconnection nsurlrequest

我有一个简单的应用程序,它使用标准 NSURLConnection 从网页访问 cookie。该应用程序的现有版本工作正常(为 3.0 开发),但是,我修改了该应用程序(使其完全兼容 iOS4),现在我在日志中收到以下警告:

CFHTTPCookieGetCreateDate is deprecated in this OS build. Clients must call CFHTTPCookieGetCreationTime or the NS equivalent instead or risk leaks.

该应用程序仍然运行良好,但我担心“泄漏”,有什么想法吗???我在我的应用程序中找不到“CFHTTPCookieGetCreateDate”!

我认为问题发生在:

- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
self.responseData = [NSMutableData data];

// information returned from the cookie
NSDictionary *headerFields = [(NSHTTPURLResponse*)response allHeaderFields]; 
NSURL *url = [NSURL URLWithString:urlString];

//Cookies Array 
cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headerFields forURL:url];

headerPointsTotal = [[NSString alloc] initWithFormat:@"%@", [cookies objectAtIndex:2]];

}

谢谢

最佳答案

已弃用仅意味着您应该谨慎使用它。这意味着在以后的 iOS 版本中,此方法可能会被删除,然后你就会崩溃。

出于兴趣,您可以将部署目标仅设置为 4.0,然后查看是否再次出现。否则(如果这与您的代码无关)您可以忽略它。

关于iphone - CFHTTPCookieGetCreateDate 在此操作系统版本 (iOS4) 中已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3968641/

相关文章:

asp.net - 将 session 信息存储在 ASP.Net Cookie 或 session 状态中?

iphone - 协同设计 "The operation was cancelled by the user"

iphone - 操作系统版本中的“位置”(地理定位)支持

iphone - Xcode 本地化让我抓狂!不加载 Storyboard

iphone - 执行 "if"条件 "x"毫秒并停止 "y"毫秒并重复条件?

iphone - 生成当月的随机日期

javascript - 在 http 响应中与 html 文档一起发送 JWT

unit-testing - 签名 cookie 和测试 :unit don't mix: "NoMethodError"

iphone - 我可以在 iPhone 移动版 Safari 上访问所有打开的网站的 URL 吗?

iphone - AVMutableComposition - 是否可能有 2 个并行音轨?