RestKit没有发送POST参数

时间:2012-11-23 10:37:39

标签: objective-c restkit

我发送

[self.responseObjectManager.client post:@"" usingBlock:^(RKRequest * request){

    RKParams * params = [RKParams params];

    [params setValue:@"VALUE1" forParam:@"PARAM1"];

    request.params = params;

    request.onDidLoadResponse = ^(RKResponse *response){

        ALog(@"Loaded resp %@", response.bodyAsString);

    };

}];

的index.php

header('Content-Type: application/json');

echo "WHAT IS ".$GLOBALS['HTTP_RAW_POST_DATA']." ANOTHER".@file_get_contents('php://input');
echo "POST ".var_dump($_POST)." GET ".var_dump($_GET); 

然后我回来了

"Loaded resp POST  GET "

所以看起来邮件参数不发送

1 个答案:

答案 0 :(得分:0)

问题在于

[self.responseObjectManager.client post:@"" usingBlock:^(RKRequest * request){

必须直接指定index.php

[self.responseObjectManager.client post:@"/index.php" usingBlock:^(RKRequest * request){

而不是回复是可以改变的

$GLOBALS['HTTP_RAW_POST_DATA']