我想知道何时在NSHTTPCookieStorage中设置cookie。是否有一个on change方法或事件处理程序?我想防止设置cookie。
我想知道何时在NSHTTPCookieStorage中设置cookie。是否有一个on change方法或事件处理程序?我想防止设置cookie。
您可以通过以下通知来监听cookie更改。
NSHTTPCookieManagerCookiesChangedNotification。
下面是苹果文档链接。
例子:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(methodYouWantToInvoke) //note the ":" - should take an NSNotification as parameter
name:NSHTTPCookieManagerCookiesChangedNotification
object:nil];