這裏是我的代碼每對中的第二個對象必須是非零。或者,你忘了沒有終止你的參數列表?'
NSMutableArray * myArray = [[NSMutableArray alloc]init];
NSMutableDictionary * myData = [[NSMutableDictionary alloc]init];
[myData setValue:@"151" forKey:@"LoginID"];
[myData setValue:@"0" forKey:@"UserID"];
[myData setValue:@"0" forKey:@"SubUserID"];
[myData setValue:@"92" forKey:@"WorkGroupID"];
[myData setValue:@"Doctor" forKey:@"WorksFor"];
[myData setValue:@"0" forKey:@"UserWorkGroup"];
[myArray addObject:myData];
myData = [[NSMutableDictionary alloc]init];
[myData setValue:@"," forKey:@"SortingName"];
[myData setValue:@"1" forKey:@"Searching"];
[myData setValue:@"Desc" forKey:@"SortingOrder"];
[myData setValue:@"10" forKey:@"RecordsCount"];
[myData setValue:@"0" forKey:@"PageIndex"];
[myArray addObject:myData];
NSData *dataToSend = [NSJSONSerialization dataWithJSONObject:myArray options:0 error:nil];
NSString *jsonString = [[NSString alloc] initWithData:dataToSend encoding:NSUTF8StringEncoding];
[getProfileServices sendSynchronousPostRequestWithStringForAction:getProfileURL andParameters:[[NSDictionary alloc]initWithObjectsAndKeys:jsonString ,nil]andRequestType:@"POST"];
當我運行此我得到這個錯誤
NSInvalidArgumentException
,原因是:-[__NSPlaceholderDictionary initWithObjectsAndKeys:]:
每對第二個對象必須是非零。或者,你忘了沒有終止你的參數列表?' ***第一擲調用堆棧:
錯誤消息告訴您確切* *是什麼問題:你有'initWithObjectsAndKeys:jsonString,nil' - 錯誤消息狀態*每對中的第二個對象必須是非零*! – luk2302
我嘗試過,但沒有用 –
爲什麼'andParameters'期待字典,它用於什麼?你爲什麼通過json? – Wain