Skip to content

Commit

Permalink
fix jsonRequestManager single instance bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lzwjava committed Jul 30, 2015
1 parent 7fa4ede commit 275b1d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions LeanCloudSocial/AVOSCloudSNS.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ + (AFHTTPRequestOperationManager *)requestManager {
+ (AFHTTPRequestOperationManager *)jsonRequestManager {
static AFHTTPRequestOperationManager *jsonRequestManager;
@synchronized (self) {
jsonRequestManager = [AFHTTPRequestOperationManager manager];
// 避免服务器不规范,没有返回 application/json
jsonRequestManager.responseSerializer.acceptableContentTypes = [jsonRequestManager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/plain"];
if (!jsonRequestManager) {
jsonRequestManager = [AFHTTPRequestOperationManager manager];
// 避免服务器不规范,没有返回 application/json
jsonRequestManager.responseSerializer.acceptableContentTypes = [jsonRequestManager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/plain"];
}
}
return jsonRequestManager;
}
Expand Down

0 comments on commit 275b1d2

Please sign in to comment.