我在 json 解析过程中遇到错误。当我尝试使用浏览器发送参数时,它会向我发送记录存储成功的成功消息。但是当我通过 iphone 发送表单参数时,我什么也得不到,在数组中我得到NULL
了值。这是 json 解析代码。
NSString *string1 = [[NSString alloc]initWithFormat:@"http://195.78.76.34/bedspace/mobileapi.php?action=save_room_info&Area=%@&Address=%@&Living_room=%@&Amenties=%@&Type_of_cost=%@&cost_of_room=%@&Security_deposit=%@&STLC=%@&Days_available=%@&Bill_included=%@&Broadband_available=%@&Exc_Smoke=%@&Exc_gender=%@&Exc_pets=%@&Exc_age=%@&Exc_language=%@&Exc_nationality=%@&Exc_Sexorientition=%@&Exc_intrest=%@&Pre_smoke=%@&Pre_gender=%@&Pre_occupation=%@&Pre_pets=%@&Pre_min_age=%@&Pre_max_age=%@&Pre_nationaltiy=%@&Pre_Language=%@&Pre_Sexorientition=%@&Misc=%@&Title=%@&Description=%@&Your_name=%@&Your_email=%@&Email_alert=%@&No_of_rooms=%@&Country=%@&City=%@&State=%@&Size_of_property=%@&Type_of_property=%@&Occupets_property=%@&My_property_status=%@&Amenties_two=%@&Size_of_room=%@&Refrence_required=%@",area,address,livingRoomVal,amenties,typeOfCost,costOfRoom,securityDeposit,STLC,daysAvailable,billsIncluded,broadbandAvailable,eSmoke,eGender,ePets,eAge,eLanguage,eNationality,eSexOrientation,eInterest,pSmoke,pGender,pOccupation,pPets,pMinAge,pMaxAge,pNationality,pLanguage,pSexOrientation,misc,title,description,yourName,yourEmail,emailAlerts,noOfRooms,country,city,state,sizeOfProperty,typeOfProperty,occupentsOfProperty,myPropertyStatus,amentiesTwo,sizeOfRoom,refrenceRequired];
NSLog(@"string 1 value %@",string1);
NSURL *urlRequest = [NSURL URLWithString:string1];
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:urlRequest];
NSData *dataResponce = [NSURLConnection sendSynchronousRequest:request returningResponse:Nil error:Nil];
NSError *jsonParsingError = nil;
NSArray *publicTimeline = [NSJSONSerialization JSONObjectWithData:dataResponce options:0 error:&jsonParsingError];
NSLog(@"get values %@",publicTimeline);
我不知道问题是什么。我也使用过SBJsonParser
,但我在数组中什么都没有,之后我使用了 NSJSONSerialization,同样的问题仍然发生,我在 NSData 和 NSArray 中什么也没有。