[英]ios - How to declare setToken method?
I'm trying to get access token from Google,Yahoo.But I'm getting an error like WACloudAccessControlClient may not respond to setToken.How to declare setToken method here. 我正在尝试从Google,Yahoo获取访问令牌。但是我遇到了类似WACloudAccessControlClient的错误,该错误可能无法响应setToken。如何在此处声明setToken方法。
-(BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
{
if(_url)
{
/* make the call re-entrant when we re-load the content ourselves */
if([_url isEqual:[request URL]])
{
return YES;
}
[_url release];
}
_url = [[request URL] retain];
NSString* scheme = [_url scheme];
if([scheme isEqualToString:@"acs"])
{
// parse the JSON URL parameter into a dictionary
NSDictionary* pairs = [self parsePairs:[_url absoluteString]];
if(pairs)
{
WACloudAccessToken* accessToken;
accessToken = [[WACloudAccessToken alloc] initWithDictionary:pairs];
[WACloudAccessControlClient setToken:accessToken];
[self dismissModalViewControllerAnimated:YES];
}
return NO;
}
[NSURLConnection connectionWithRequest:request delegate:self];
return NO;
}
Any ideas? 有任何想法吗? Thanks in advance.
提前致谢。
You need to pass the message to an object not a class name so first get a reference to an object. 您需要将消息传递给对象而不是类名,因此首先需要获得对对象的引用。
I'm not sure what is your usecase, just look at WACloudAccessControlClient
api it will have some init
or ...with...
methods to create or get a reference to an object of the class. 我不确定您的用例是什么,只需看一下
WACloudAccessControlClient
api,它将有一些init
或...with...
方法来创建或获取对该类对象的引用。
This: 这个:
[WACloudAccessControlClient setToken:accessToken];
Should be something like (the init...
method is made up, please replace with actual one): 应该是这样的(
init...
方法组成,请用实际的方法代替):
[[WACloudAccessControlClient initSomethingSomehow] setToken:accessToken];
Are you after something like this?: 您是否正在追求这样的目标?:
[[WACloudAccessControlClient accessControlClientForNamespace:@“namespace-name”
realm:@“realm-name”]
setToken:accessToken];
Edit: 编辑:
Have a look at this example of how to interact with wa toolkit for iOS I've just skimmed through but it seems to have answers you are looking for. 看一下这个示例,该示例说明了如何与我刚刚浏览过的iOS的wa工具包进行交互,但是似乎您正在寻找答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.