CFPropertyList kullanım

0 Cevap php

i hesaplar CFPropertyLIst kullanarak benim iphone nesnel c app benim sunucuda süresi doldu ama NSURLConnection geri arama döndürülen veriler her zaman null olan kullanıcıların bir listesini döndürmek için çalışıyorum. Ben CFPropertyList benim kullanılması doğru olmayabilir düşünüyorum ama neden çalışamaz

$query="SELECT user, UNIX_TIMESTAMP(created) AS created_ts FROM  accounts"
$result = mysql_query($query)  


$userarray = new CFArray ();
while($row = mysql_fetch_array($result))
{
    $user = $row['user'];
    $created_ts = $row['created_ts'];

   $entry = new CFDictionary();
   $entry->add('user', new CString($user));
   $entry->add('created_ts', new CFNumber($created_ts));
   $userarray->add($entry);

}

$plist = new CFPropertyList();
$plist->add($userarray);
$plist->toXML();
var_dump($plist);

Objective C

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    // We have got everything so no longer need the connection so release it.
    [theConnection release];
    theConnection = nil;

NSString *errorString = nil;
NSArray *array = [[NSPropertyListSerialization 
                       propertyListFromData:theData
                       mutabilityOption:NSPropertyListImmutable
                       format:nil
                       errorDescription:&errorString] retain];

}

Here I'm always getting unexpected character o at line 1 because the format of the plist looks like this which appears ok but still always getting this error

object(CFPropertyList)#5 (17)
{ ["file:protected"]=> NULL
["format:protected"]=> int(0)
["value:protected"]=> array(1) {
[0]=> object(CFArray)#1 (2) { ["iteratorPosition:protected"]=> int(0) ["value:protected"]=> array(1) {
[0]=> object(CFDictionary)#2 (3) {
["iteratorPosition:protected"]=> int(0)
["iteratorKeys:protected"]=> NULL
["value:protected"]=> array(2) {
["user"]=> object(CFString)#3 (1) {
["value:protected"]=>
string(9) "anonymous"
}
["created_ts"]=>
object(CFNumber)#4 (1) {
["value:protected"]=>
int(1281263044)
}
}
}
}
}
}
["iteratorPosition:protected"]=> int(0)
["iteratorKeys:protected"]=> NULL
["content:protected"]=> NULL
["pos:protected"]=> int(0)
["uniqueTable:protected"]=>
array(0) {
}
["countObjects:protected"]=> int(0)
["stringSize:protected"]=> int(0)
["intSize:protected"]=> int(0)
["miscSize:protected"]=> int(0)
["objectRefs:protected"]=> int(0) ["writtenObjectCount:protected"]=>int(0) ["objectTable:protected"]=> array(0) { }
["objectRefSize:protected"]=>int(0)
["offsets:protected"]=>
array(0) {
}
}

0 Cevap