Domanda

These pics is what I used Charles caught. pic1 is overview. pic2 & pic3 request in form or text form, I don't know which is the right request form. pic4 is JSON I should've gotten. pic5 is after I sent my parameters what the server feed back.But it shows error code.

This is what the Charles found and I caught it.

Request

This is the request in Text tab

This is what it send back.

Now I am planning using AFNetworkingOperationManager.I don't know what the parameter is ? Here's my code

- (void)getSongSList:(NSURL *)songsListUrl{
    NSArray *array = [[NSArray alloc] initWithObjects:@"27858424", @"8738906", @"2760603" , @"7492213", @"8094802", @"12486744", @"7540057", @"8169805", @"2760613", @"7421076" ,nil];
    NSDictionary *parameters = [NSDictionary dictionaryWithObject:array forKey:@"songIds"];

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    [manager.responseSerializer setAcceptableContentTypes:[NSSet setWithObject:@"application/javascript"]];
    [manager POST:@"http://music.baidu.com/data/music/links?rate=64" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"JSON: %@", operation.responseString);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Error: %@", error);
    }];
}

But I got error code.

Erro code

Could someone tell my what is the right parameters I should post. Or tell me the right way to do this job. Thanks a lot

here's operation.request.HttpBody log

2014-08-02 19:07:36.413 LemonFM[45892:60b] Http Body: <736f6e67 4964735b 5d3d3237 38353834 32342673 6f6e6749 64735b5d 3d383733 38393036 26736f6e 67496473 5b5d3d32 37363036 30332673 6f6e6749 64735b5d 3d373439 32323133 26736f6e 67496473 5b5d3d38 30393438 30322673 6f6e6749 64735b5d 3d313234 38363734 3426736f 6e674964 735b5d3d 37353430 30353726 736f6e67 4964735b 5d3d3831 36393830 3526736f 6e674964 735b5d3d 32373630 36313326 736f6e67 4964735b 5d3d3734 32313037 36>

È stato utile?

Soluzione

Solved. I was not familiar with AFNetworking before. Now I know that should post a NSDictionary parameters first, then parse the responseObject.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top