0

我正在尝试从 cookie 中获取令牌。当我这样做时,我收到如下错误:

“请求成员‘域’不是结构或联合”

- (NSString*)getTokenFromCookie {
    NSHTTPCookie *cookie;
    NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [cookieJar cookies]) {
        if ([[cookie domain] isEqualToString:self.domain]) {
            if ([[cookie name] isEqualToString:@"oauth_token"]) {
                return [cookie value];
            }
        }
    }
    return nil;
}
4

1 回答 1

3

This happens because of self.domain

You probably haven't declared it as an @property, or self is not what you think it is.

于 2013-04-18T14:08:37.673 回答