gpt4 book ai didi

Swift NSHTTPCookieStorage 计数 :2

转载 作者:搜寻专家 更新时间:2023-11-01 06:23:47 26 4
gpt4 key购买 nike

var httpCookie:NSHTTPCookieStorage=NSHTTPCookieStorage.sharedHTTPCookieStorage();
println(httpCookie)

<NSHTTPCookieStorage cookies count:2>

如何让每个 cookie 循环一次?

最佳答案

看这段代码

var cookies:[NSHTTPCookie] = NSHTTPCookieStorage.sharedHTTPCookieStorage().cookies as [NSHTTPCookie]
for cookie:NSHTTPCookie in cookies as [NSHTTPCookie] {
if cookie.name as String == "CookieName" {
var cookieValue : String = "CookieName=" + cookie.value! as String

//if you want to add to your request
youRequest.setValue(cookieValue, forHTTPHeaderField: "cookie")
}
}

关于Swift NSHTTPCookieStorage 计数 :2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28210572/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com