,我要感謝kylebrowning爲他花費大量的時間,創造這個真棒SDK。 我面臨的問題是我可以很好地登錄,但我註銷失敗。 我NSLog看到代碼的錯誤。 這是在輸出標籤上顯示的錯誤。 我沒有足夠的信譽來發布兩個以上的鏈路 這裏是我下面的HTTP,「192.168.1.24/drupal/rest/user/logout」AFNetworkingError在IOS SDK的Drupal
域= AFNetworkingErrorDomain代碼= -1011「預期的狀態裏面是什麼代碼在(200-299),得到401「UserInfo = 0x8c4d6c0 {NSLocalizedRecoverySuggestion = [」CSRF驗證失敗「],AFNetworkingOperationFailingURLRequestErrorKey = {URL:」>「http://},NSErrorFailingURLKey = http :, NSLocalizedDescription =預期狀態代碼在(200-299),得到401,AFNetworkingOperationFailingURLResponseErrorKey = {URL:http://} {狀態碼:401,頭部「Cache-Control」=「no-cache,must-revalidate,post-check = 0,pre -check = 0" ; Connection =「Keep-Alive」; 「Content-Length」= 26; 「Content-Type」=「application/json」; 日期=「2014年3月27日星期四09:10:32 GMT」; Etag =「\」1395911432 \「」; 到期=「Sun,19 Nov 1978 05:00:00 GMT」; 「Keep-Alive」=「timeout = 5,max = 98」; 「Last-Modified」=「Thu,27 Mar 2014 09:10:32 +0000」; Server =「Apache/2.2.25(Unix)mod_ssl/2.2.25 OpenSSL/0.9.8y DAV/2 PHP/5.5.3」; 「Set-Cookie」=「SESS0fd8593946486e6ecd06721db47d9fe9 = deleted; expires = Thu,01-Jan-1970 00:00:01 GMT; Max-Age = 0; path = /; httponly」; Vary = Accept; 「X-Powered-By」=「PHP/5.5.3」; }}}
這裏是我的代碼
#import "AfterLoginViewController.h"
#import "DIOSUser.h"
#import "DIOSSession.h"
#import "DIOSSystem.h"
@interface AfterLoginViewController()
@end
@implementation AfterLoginViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (IBAction)LogOut {
[DIOSUser
userLogoutWithSuccessBlock:^(AFHTTPRequestOperation *op, id response)
{
[self alertStatus:@"Logout Successful" :@"Sign Out Successful" :0];
NSLog(@"Logout Successful");
[self alertStatus:@"LogOut Successful" :@"LogOut is completed" :0];
[self performSegueWithIdentifier:@"BackToLogin" sender:self];
/* Handle successful operation here */
}
failure:^(AFHTTPRequestOperation *op, NSError *err)
{
[self alertStatus:@"LogOut Failed" :@"LogOut failed Please Try Again !!!" :0 ];
NSLog (@"Signout failed");
NSLog (@"%@", err);
}
];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void) alertStatus:(NSString *)msg :(NSString *)title :(int) tag
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
message:msg
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil, nil];
alertView.tag = tag;
[alertView show];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
我將非常感激,如果有人可以幫助我這個問題。