, ben 401 durum kodu kodum alıyorum ve veriler sunucuya yazmıyor alma, NSURLSession kullanarak sunucuya veri göndermek için açılamıyor:NSHTTPURLResponse durum kodu 401 Burada
NSURL *url = [NSURL URLWithString:@test.com"];
NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
[request addValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setHTTPMethod:@"POST"];
self.dictionary = @{
key:Value,
key: Value
};
NSError *error = nil;
NSData *data = [NSJSONSerialization dataWithJSONObject:self.dictionary options:kNilOptions error:&error];
request.HTTPBody = data;
else {
NSLog(@"Status code: %li", (long)((NSHTTPURLResponse *)response).statusCode);
code here //
};
}];
[postDataTask resume];
}
Herhangi bir yardım olurdu takdir.
teşekkürler çok, ben bu sabit. –