Note that there are some explanatory texts on larger screens.

plurals
  1. POPost Data through json webservices in iphone
    primarykey
    data
    text
    <p>I want to post data through json webservicesmy on button click Action code is:</p> <pre><code>-(IBAction)login:(id)sender { NSString *newurlString = [NSString StringWithFormat:@"{\"name\":\"asit\",\"email\":\"m.kulkarni@easternenterprise.com\",\"businessType\":\"1\",\"score\":30}"]; NSString * url = @"http://www.nieuwe-dag.nl/mobile_be/public/?action=saveScore"; NSData *postData = [newurlString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(@"urlString::%@",newurlString); NSLog(@"postLength::%@",postLength); NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:300]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *theConnection =[[NSURLConnection alloc] initWithRequest:request delegate:self]; if( theConnection ) { webData = [[NSMutableData data] retain]; } else { NSLog(@"theConnection is NULL"); } } </code></pre> <p><strong>And response on console is:</strong> </p> <blockquote> <p>[Session started at 2011-07-25 12:36:48 +0530.] 2011-07-25 12:36:48.860 DepartmentalStoreAdmin[2490:207] Could not load the "header.png" image referenced from a nib in the bundle with identifier "com.easternenterprise.dag" 2011-07-25 12:36:48.864 DepartmentalStoreAdmin[2490:207] Could not load the "leher.png" image referenced from a nib in the bundle with identifier "com.easternenterprise.dag" 2011-07-25 12:36:50.708 DepartmentalStoreAdmin[2490:207] urlString::{"name":"asit","email":"m.kulkarni@easternenterprise.com","businessType":"1","score":30} 2011-07-25 12:36:50.709 DepartmentalStoreAdmin[2490:207] postLength::88 2011-07-25 12:36:52.376 DepartmentalStoreAdmin[2490:207] DONE. Received Bytes: 52 2011-07-25 12:36:52.377 DepartmentalStoreAdmin[2490:207] </p> <p>THEXML {"result":"ERROR","errors":["Name cannot be empty"]}</p> </blockquote> <p>I dont have any idea why it is not post. Please any one help me its very urgent.</p> <p>Thanks in Advance:</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload