1

我一直在搜索,但到目前为止还没有解决方案。这就是我使用 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
                }
            }
        });
    }];

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

4

0 回答 0