In php I have:
$result = mysql_query($query); // if successful query, return the records if ($result) { // if not empty result, return array of records if (mysql_num_rows($result)) { $records = array(); while ($row = mysql_fetch_assoc($result)) { $records[] = $row; } return $records; } }
In Objective-C – After the POST I have the following code…
NSURLResponse *newStr = [[NSURLResponse alloc] init]; NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:&newStr error:nil];
returnData is equal to the literal ‘Array’, not the contents of $records[]
You should serialise the data into a XML type
plistformat if you can, then it can be natively interpreted by Cocoa classes like NSArray and NSDictionary. NSPropertyListSerializer is capable of producing mutable or immutable arrays and dictionaries from a file or from an NSData object containing serialized data in plist format.NSDictionary can also read files in this format:
Likewise, NSArray can read files in this format:
In fact, I think if the strings don’t contain spaces, the quotes are optional (but I guess they would force string types).
Check out this URL for more information about oldschool ASCII property lists. They are read-only, but then again they are easy enough to generate manually or systematically.