0

codeIgniter Web サービスに POST を実行しようとしていますが、常に同じメッセージが表示されます。

-> [13884:a0b] サーバーから送信された文字列は許可されていないキー文字です。

何かアイデアはありますか?ありがとう

kUrl @" http://gf.kineth.com/index.php/json_api/ "を定義します

これが私の機能です

-(void)postMessageLogin:(NSString *)login:(NSString *)pass{//Login device selected = 1;

NSMutableString *postString = [NSMutableString stringWithString:kUrl];
//a = 1 melhor variavel do mundo, faz cenas incriveis




[postString appendFormat:@"loginUser?data={\"email\":\"joao.vitor.pac@gmail.com\",\"password\":\"123456\"}"];


[postString setString:[postString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];



NSLog(@"%@",postString);

NSString *myRequestString = postString;
NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length ] ];

request = [ [ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString:kUrl ] ];
[ request setHTTPMethod: @"POST" ];
[ request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[ request setHTTPBody: myRequestData ];



NSURLConnection * connection = [[NSURLConnection alloc]
                                initWithRequest:request
                                delegate:self startImmediately:NO];


[connection scheduleInRunLoop:[NSRunLoop mainRunLoop]
                      forMode:NSDefaultRunLoopMode];
[connection start];

}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)theData{ NSLog(@"String sent from server %@",[[NSString alloc] initWithData:theData encoding:NSUTF8StringEncoding]);

     NSError *error;
    NSDictionary *dic;
    dic = [NSJSONSerialization JSONObjectWithData:theData options:0 error:&error];



    NSLog(@"[SL] JsonPost : didReceiveData %@",dic);
    NSLog(@"[SL] JsonPost : didReceiveData %@",error);


[connection cancel];

}

4

2 に答える 2