-1
-,我試圖創建結構使用AFNetworking 2.0一個JSONObjects的創建JSONArray Objective-C的
[{'category_id': '3'}, {'category_id': '2'}, {'category_id': '1'}]
-我試圖創建一個使用該結構的NSMutableDictionary
& NSMutableArray
一樣,我回來是:
<__NSArrayM 0x7c186080>(
{
"category_id" = 1;
},
{
"category_id" = 2;
},
{
"category_id" = 3;
}
)
-我送這通過HTTPPost
服務器。
-但在服務器上請求到達爲:
{(null)[][category_id]': ['1', '2', '3']}
這是不想要的格式,因爲我在點之上顯示1
-任何人都可以請幫助我出去創建一個JSONArray
的JSONObjects
,我會非常感激。
,我用來創建和發送請求到服務器的代碼是:
-(void) getProductList:(NSString *)strToken andCatId:(NSArray *)arrCategory{
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager.requestSerializer setValue:strToken forHTTPHeaderField:@"Authorization"];
manager.responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingAllowFragments];
NSString *strSuffix = @"unfollow/productList/";
NSString *strUrl = [NSString stringWithFormat:@"%@%@",BASE_URL,strSuffix];
api_categoryProductList *currentObj = self;
[manager POST:strUrl parameters:arrCategory success:^(AFHTTPRequestOperation *operation, id responseObject) {
[currentObj httpOperationDidSuccess:oper
ation responseObject:responseObject];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[currentObj httpOperationDidFail:operation error:error];
}];
}