Note that there are some explanatory texts on larger screens.

plurals
  1. POAFNetworking Expected content type "application/xml", "text/xml", text/plain
    primarykey
    data
    text
    <p>I am trying to log into google reader using AfNetworking AfHttpClient but I am getting this error that I can;t seem to figure out. </p> <p>Below is my subclass of AFNetworking:</p> <pre><code>// main url endpoints #define GOOGLE_ACCOUNTS_BASE_URL @"https://www.google.com/accounts/" @implementation ADPGoogleLoginClient + (ADPGoogleLoginClient *)sharedClient { static ADPGoogleLoginClient *_sharedClient = nil; static dispatch_once_t onceToken; dispatch_once(&amp;onceToken, ^{ _sharedClient = [[ADPGoogleLoginClient alloc] initWithBaseURL:[NSURL URLWithString:GOOGLE_ACCOUNTS_BASE_URL]]; }); return _sharedClient; } - (id)initWithBaseURL:(NSURL *)url { self = [super initWithBaseURL:url]; if (!self) { return nil; } [self registerHTTPOperationClass:[AFXMLRequestOperation class]]; // Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 [self setDefaultHeader:@"Content-type" value:@"text/plain"]; [self setDefaultHeader:@"Accept" value:@"text/plain"]; return self; } @end </code></pre> <p>And then I try to form a request by using the following code:</p> <pre><code>//set up request params NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: @"googlereader-ios-client", @"client", [keychainCredentials objectForKey:(__bridge id)kSecAttrAccount], @"Email", [keychainCredentials objectForKey:(__bridge id)kSecValueData], @"Passwd", @"reader", @"service", @"ipad", @"source", nil]; //make requests [[ADPGoogleLoginClient sharedClient] getPath:@"ClientLogin" parameters:params success:^(AFHTTPRequestOperation *operation , id responseObject) { //parse out token and store in keychain NSString* responseString = [operation responseString]; NSString* authToken = [[[responseString componentsSeparatedByString:@"\n"] objectAtIndex:2] stringByReplacingOccurrencesOfString:@"Auth=" withString:@""]; keychainToken = [[KeychainItemWrapper alloc] initWithIdentifier:@"GReaderToken" accessGroup:nil]; [keychainToken setObject:authToken forKey:(__bridge id)kSecValueData]; loginSuccess(); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"There was an error logging into Reader - %@", [error localizedDescription]); loginFailure(error); }]; </code></pre> <p>Im setting the default headers to </p> <pre><code>[self setDefaultHeader:@"Content-type" value:@"text/plain"]; [self setDefaultHeader:@"Accept" value:@"text/plain"]; </code></pre> <p>so im not sure why it still thinks it is expecting xml?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload