从服务器获取数据时,我收到以下错误:
NSInvalidArgumentException reason: data parameter is nil
这是我的代码:
- (void)retrieveData
{
NSURL *url = [NSURL URLWithString:@"http://magmasysdev.com/ddc/getAllCompanies.php"];
NSData *data = [NSData dataWithContentsOfURL:url];
jsonArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; // I'm getting error in this line
}
我想在数组中存储以下响应:
[{"status":"Y"},{"company_data":[{"Company_Id":"5","Company_Name":"SANTE (PVT) LIMITED","Company_Address":"245\/2-Z P.E.C.H.S Block-6 \nKarachi-75400,Pakistan","Company_Email":"sante@sante.com.pk","Company_Tel_Num":"4520507, 4533425","Company_Website":"www.sante.com.pk","Company_Fax_Num":"4.54885e+006"}