php - Trying to get plist data from server but getting nothing -
i building app in need data server here code
nsstring *url = [nsstring stringwithformat:@"http://url/ios/jobsearch.php"]; nsdictionary *datadict = [[nsdictionary alloc] initwithcontentsofurl:[nsurl urlwithstring:url]]; originalresultarray=[datadict valueforkey:@"objects"]; jobresultarray=[[nsmutablearray alloc] init]; [jobresultarray addobjectsfromarray:originalresultarray]; nslog(@"result : %@",jobresultarray);
and here jobsearch.php
<plist version="1.0"> <dict> <key>objects</key> <array> <dict> <key>jobname</key> <string>asdfasdf111</string> <key>jobbids</key> <integer>3</integer> <key>jobpay</key> <integer>$30</integer> <key>jobid</key> <integer>3</integer> </dict> <dict> <key>jobname</key> <string>asdfasdf1111111333</string> <key>jobbids</key> <integer>1</integer> <key>jobpay</key> <integer>$36</integer> <key>jobid</key> <integer>5</integer> </dict> </array> </dict> </plist>
with code getting noting in return. there 2 dict in php file if see , every dict have 4 keys in it. if remove 2 keys every dict , have 2 keys in case data in array. need 4 keys data. please help. in advance.
the data isn't in right format.
change
<key>jobpay</key> <integer>$30</integer>
to
<key>jobpay</key> <string>$30</string>
now data in right format.
below complete data.
<plist version="1.0"> <dict> <key>objects</key> <array> <dict> <key>jobname</key> <string>asdfasdf111</string> <key>jobbids</key> <integer>3</integer> <key>jobpay</key> <string>$30</string> <key>jobid</key> <integer>3</integer> </dict> <dict> <key>jobname</key> <string>asdfasdf1111111333</string> <key>jobbids</key> <integer>1</integer> <key>jobpay</key> <string>$36</string> <key>jobid</key> <integer>5</integer> </dict> </array> </dict>
final output:
Comments
Post a Comment