Note that there are some explanatory texts on larger screens.

plurals
  1. POMySql Database import error within app
    text
    copied!<p>I’m getting the following error all of a sudden. My app has not been updated nor has the database been changed. I’m not sure what is going on.<br> This is the error I’m getting in the log. I”ll list the php code and the import area from the xcode project as well. Hopefully someone will have an idea of what might have happened.</p> <pre><code>-JSONValue failed. Error trace is: ( "Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character\" UserInfo=0x911e5c0 {NSLocalizedDescription=Unrecognised leading character}" ) //php code &lt;?php $link = mysql_connect('localhost', ‘username', ‘pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("thedb"); $action = $_GET['action']; if(!empty($action)) { if($action == 'listquote') { $result = mysql_query("SELECT * FROM quote ORDER BY id DESC"); $rows = array(); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if($row) $rows[] = $row; } echo json_encode($rows); } } mysql_close($link); ?&gt; DataImportOperation - (NSError *)processData:(NSData *)content{ NSString *result = [[NSString alloc] initWithData:content encoding:NSUTF8StringEncoding]; NSArray *arrayList = [result JSONValue]; [result release]; result = nil; NSString *filePath = [CWAppSettings pathDicData]; //NSMutableDictionary *dictWrite = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath]; NSMutableDictionary *dictWrite = [[NSMutableDictionary alloc] init]; NSMutableArray *plistArray = [[NSMutableArray alloc] init]; NSArray *allValues = [dictWrite objectForKey:@"Quotes"]; if ([allValues count] &gt; 0) { for (NSArray *temp in allValues) { [plistArray addObject:temp]; } } NSAutoreleasePool *aPool = [[NSAutoreleasePool alloc] init]; long long timestamp = 0;//= [[plistArray objectForKey:@"timestamp"] longLongValue]; for (NSDictionary *dict in arrayList) { if ([dict objectForKey:@"quote"] != nil) { NSString *quote = [dict objectForKey:@"quote"]; if ([[NSString stringWithFormat:@"%@", quote] isEqualToString:@"&lt;null&gt;"]) continue; NSString *idQuote = [dict objectForKey:@"id"]; NSArray *array = [NSArray arrayWithObjects:idQuote,quote, nil]; [plistArray addObject:array]; DLog(@"%@", quote); } } [dictWrite setValue:plistArray forKey:@"Quotes"]; [dictWrite writeToFile:filePath atomically:YES]; if (timestamp != 0) { [CWAppSettings setLastUpdate:timestamp]; } if (self.delegate &amp;&amp; [self.delegate respondsToSelector:@selector(retrieveListOperationDidFinishImportingData)]) { [self.delegate retrieveListOperationDidFinishImportingData]; } if (dictWrite != nil) { [dictWrite release]; dictWrite = nil; } if (plistArray != nil) { [plistArray release]; plistArray = nil; } if (aPool != nil){ [aPool release]; aPool = nil; } return nil; </code></pre> <p>}</p> <p>Like I said... its just weird, because all of a sudden it stopped working. I’m not sure what might have changed. The content is still in the database.</p>
 

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