I have a buddy who is building the web server side of things and he needs my iphone app to send him a request. I don't have any experience in this type of programming so it is proving to be a bit difficult.
I am trying to do a simple request that looks like this:
        ASIFormDataRequest *request = [ASIFormDataRequest request开发者_开发百科WithURL:
[NSURL URLWithString:@"http://thewebserverURL"]];
        [request setPostValue:[NSString stringWithCString:txtName
encoding:NSUTF8StringEncoding] forKey:@"field02"];
        [request setPostValue:[NSString stringWithCString:txtTodaysDate
encoding:NSUTF8StringEncoding] forKey:@"field05"];
        [request startSynchronous];
        NSLog(@"%@",[request responseString]);
I am getting 2 errors on each of the "request setPostValue" lines that read "Passing argument 1 of stringWithCString: encoding from incompatible pointer type."
txtName and txtTodaysDate are both NSStrings. What am I doing wrong?
The setPostValue parameter is supposed to be a NSString, so you can just pass txtName and txtTodaysDate directly.  stringWithCString is used for converting a NUL-terminated C string to a NSString.  Thus, the first parameter is a char *.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论