AFNetworking Http header sometime is nil
up vote
0
down vote
favorite
I have a very strange problem.
when i use afnetworking with http header,sometimes the servers can not get my http header value,it's nil,nothing in header.
i have no idea why.
this is my code:
NSString *url = [NSString stringWithFormat:@"%@%@",[YJHttpService serverDomain],method];
[manger.requestSerializer setValue:@"1" forHTTPHeaderField:@"source"];
[manger.requestSerializer setValue:user.user.token forHTTPHeaderField:@"token"];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString *versionCode = [version stringByReplacingOccurrencesOfString:@"." withString:@""];
[manger.requestSerializer setValue:version forHTTPHeaderField:@"version"];
[manger.requestSerializer setValue:versionCode forHTTPHeaderField:@"versionCode"];
ios afnetworking
add a comment |
up vote
0
down vote
favorite
I have a very strange problem.
when i use afnetworking with http header,sometimes the servers can not get my http header value,it's nil,nothing in header.
i have no idea why.
this is my code:
NSString *url = [NSString stringWithFormat:@"%@%@",[YJHttpService serverDomain],method];
[manger.requestSerializer setValue:@"1" forHTTPHeaderField:@"source"];
[manger.requestSerializer setValue:user.user.token forHTTPHeaderField:@"token"];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString *versionCode = [version stringByReplacingOccurrencesOfString:@"." withString:@""];
[manger.requestSerializer setValue:version forHTTPHeaderField:@"version"];
[manger.requestSerializer setValue:versionCode forHTTPHeaderField:@"versionCode"];
ios afnetworking
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a very strange problem.
when i use afnetworking with http header,sometimes the servers can not get my http header value,it's nil,nothing in header.
i have no idea why.
this is my code:
NSString *url = [NSString stringWithFormat:@"%@%@",[YJHttpService serverDomain],method];
[manger.requestSerializer setValue:@"1" forHTTPHeaderField:@"source"];
[manger.requestSerializer setValue:user.user.token forHTTPHeaderField:@"token"];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString *versionCode = [version stringByReplacingOccurrencesOfString:@"." withString:@""];
[manger.requestSerializer setValue:version forHTTPHeaderField:@"version"];
[manger.requestSerializer setValue:versionCode forHTTPHeaderField:@"versionCode"];
ios afnetworking
I have a very strange problem.
when i use afnetworking with http header,sometimes the servers can not get my http header value,it's nil,nothing in header.
i have no idea why.
this is my code:
NSString *url = [NSString stringWithFormat:@"%@%@",[YJHttpService serverDomain],method];
[manger.requestSerializer setValue:@"1" forHTTPHeaderField:@"source"];
[manger.requestSerializer setValue:user.user.token forHTTPHeaderField:@"token"];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString *versionCode = [version stringByReplacingOccurrencesOfString:@"." withString:@""];
[manger.requestSerializer setValue:version forHTTPHeaderField:@"version"];
[manger.requestSerializer setValue:versionCode forHTTPHeaderField:@"versionCode"];
ios afnetworking
ios afnetworking
edited Nov 8 at 13:41
Scriptable
11.8k43253
11.8k43253
asked Nov 8 at 8:30
wei mao
62
62
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203947%2fafnetworking-http-header-sometime-is-nil%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password