Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to parse JSON in Xcode NSCocoaErrorDomain Code=3840
    primarykey
    data
    text
    <p>I've been parsing JSON in Xcode like so:</p> <pre><code>-(void)getCheckUserData:(NSData *)data { NSError *error; if (!error) { checkUserJSON = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;error]; } else{ UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Uh Oh" message:@"Spaghetti-O" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; } } -(void) startCheckingUserLogin { NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:kCheck_user] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0]; NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (theConnection) { NSURL *url = [NSURL URLWithString:kCheck_user]; NSData *data = [NSData dataWithContentsOfURL:url]; [self getCheckUserData:data]; } } </code></pre> <p>But I hired a web developer and he updated my outdated php files that took data from phpmyadmin and encoded it in JSON. Now I get an NSCocoaErrorDomain Code=3840 message in xcode. </p> <p>Here is the php file I grab the data from:</p> <pre><code> &lt;?php require_once( 'classes/secure.php' ); $SECURE = new Secure(); if( !isset( $_POST[ 'var1' ] ) ) { exit("ERROR: no var1"); } if( !isset( $_POST[ 'var2' ] ) ) { exit("ERROR: no var2"); } $VARONE = $_POST[ 'var1' ]; $VARTWO = $_POST[ 'var2' ]; $RESULT = $SECURE-&gt;checkPassword( $VARONE, $VARTWO ); // Check VARONE / VARTWO unset( $SECURE ); // Unset Secure exit( json_encode( $RESULT ) ); // Return result as JSON string ?&gt; </code></pre> <p>What do I need to change?</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.
    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