如何使用unirest-obj-c

时间:2016-03-22 04:36:43

标签: objective-c unirest

到目前为止,我一直在搜索但没有解决方案..这就是我使用Unirest提出GET请求的方式:

    [[UNIRest get:^(UNISimpleRequest *simpleRequest) {
        [simpleRequest setUrl:[NSString stringWithFormat:@"%@location/retrieve_post",C_baseURL]];
        [simpleRequest setHeaders:headers];
        [simpleRequest setUsername:@"username"];
        [simpleRequest setPassword:@"password"];
    }] asJsonAsync:^(UNIHTTPJsonResponse *response, NSError *error) {
        // This is the asyncronous callback block
        dispatch_async(dispatch_get_main_queue(), ^{
            if(response.code == 200) {
                // if code is wrong
                BOOL status = [[response.body.object valueForKeyPath:@"callback"] boolValue];
                //            NSLog(@"%d",status);
                if(status) {
                    // display data
                } else {
                    // no data
                }
            }
        });
    }];

有没有办法听取响应的下载进度?

0 个答案:

没有答案