oc 封装json 传递

NSString *reqData = @"Data=";

    NSData *postDatas = nil;

    NSString *urlPath = @"url";

//组json字符串数据

    NSMutableDictionary *mulDic = [[[NSMutableDictionary alloc] init] autorelease];

    [mulDic setValue:@"P003" forKey:@"type"];postDatas = [NSJSONSerialization dataWithJSONObject:mulDic options:NSJSONWritingPrettyPrinted error:nil];

        NSString *str = [[NSString alloc] initWithData:postDatas encoding:NSUTF8StringEncoding];

        reqData = [reqData stringByAppendingString:str];

        NSLog(@"reqData:%@",reqData);

你可能感兴趣的:(遇到的问题)