i am developing an iphone app that receive data from sql server through php file in JSON format , it work fine when test it on safari browser, also i used SBJSON framework
to develop the JSON in my app ,i received the data in my app but in wrong format like this :
["الدرس الثالث عشر - المؤقت - UIDatePicker ","الدرس الثامن - الانتقال من صفحه لاخرى - UISwipeGestureRecognizer","الدرس الاول - مقدمة لتطوير تطبيقات الايفون - introduction to Xcode ","الدرس الثاني - إنشاء أول تطبيق على الايفون - create your frst app in iphone ","الدرس الثالث - استخدام حقل المدخلات - Using of JTextField in Xcode ","الدرس الرابع - استخدام العداد في برمجة الايفون - Using UIslider and UIstepper ","الدرس الخامس - استخدام الصورة و السويتش - Using UISwitch and UIImageView ","الدرس السادس - عمل اله حاسبة للايفون ج١ - Create Calculator for iPhone part 1 ","الدرس السادس - Create Calculator for iPhone part 2 - عمل اله حاسبه للايفون ج٢ ","الدرس السابع - عرض الملفات على صفحة ويب - Loading PDF,PPT on UIWebview ","الدرس التاسع - متصفح انترنت للايفون - web browser for iphone ","الدرس الثامن - الانتقال من صفحه لاخرى - UISwipeGestureRecognizer","الدرس العاشر - مغّير القيم - UISegmentedControl","الدرس الحادي عشر - خلايا الجداول - uitableviewcell & uinavigationcontroller","الدرس الثاني عشر -التاب بار - UITabBarController"]
the other problem when i try to parse it , it gives me null result
NSString *url = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://localhost:8888/newjson.php"] encoding:NSUTF8StringEncoding error:nil];
SBJsonParser *parser = [[SBJsonParser alloc] init];
listt = [parser objectWithString:url];
listt (NSArray)
You should start by passing an
NSError *to your URL fetch function to look for an error.The JSON you posted is valid (though the strings appear to be HTML-encoded for some reason). What happens if you NSLog the value of
listt? The value ofurl?