问题
I'm trying to get token,but getting warning message like 'WACloudAccessControlClient, may not respond to setToken
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [[NSURL alloc] initWithString:@"URL"];
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?
回答1:
Seems like WACloudAccessControlClient is a class, not an instance variable in the code you wrote.
When you are calling something like [AClass someMethod], you are actually working with structure of AClass, not with an instance. Structure cannot save/store in memory any runtime data, because it doesn't have allocated memory.
If WACloudAccessControlClient is an instance variable in this code, then it's not imported with statement:
#import "WACloudAccessControlClient.h"
... or something similar to this. Compiler cannot detect any method declared with such signature. For more information about class methods read this.
来源:https://stackoverflow.com/questions/16231636/ios-wacloudaccesscontrolclient-may-not-respond-to-settoken