summaryrefslogtreecommitdiff
path: root/Juick/APIClient.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-18 01:48:34 +0300
committerGravatar Vitaly Takmazov2017-10-18 01:48:34 +0300
commit2345989ce454342d8ac45077e2cd650d18744066 (patch)
treea1c529b1dadab49c76b82da80044cc4a80d32ec0 /Juick/APIClient.m
parent07afcd6f36629f30a495f2be47262c75c006712f (diff)
device registration
Diffstat (limited to 'Juick/APIClient.m')
-rw-r--r--Juick/APIClient.m5
1 files changed, 1 insertions, 4 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m
index d2356b5..beace7c 100644
--- a/Juick/APIClient.m
+++ b/Juick/APIClient.m
@@ -23,16 +23,13 @@
-(id)init {
if (self = [super init]) {
self.manager = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:@"https://api.juick.com"]];
+ self.manager.requestSerializer = [AFJSONRequestSerializer new];
}
return self;
}
-(void) pullNextFromPath:(NSString *)path params:(NSDictionary *) params callback:(void(^)(NSArray *, NSError *))callback {
AFHTTPSessionManager *manager = [APIClient sharedClient].manager;
- if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] != nil) {
- manager.requestSerializer = [AFJSONRequestSerializer serializer];
- [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]];
- }
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[manager GET:path parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSMutableArray *messages = [NSMutableArray new];