app 与 服务器 交互
step1封装post数据 //请求地址 NSString *url = [NSString stringWithFormat:@"%@%@", [PKConfig apiUrl], service]; PKLog(@"请求地址是 %@",url); //时间戳 long long timestamp = [[NSDate date] timeIntervalSince1970]; NSString *timestampStr = [NSString stringWithFormat:@"%lld", timestamp]; //参数 NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init]; NSData *postData = nil; if(type!=1){ // Service [parameters setObject:service forKey:@"service"]; // ID [parameters setObject:timestampStr forKey:@"id"]; // Common NSMutableDictionary *commonDict = [[NSMutableDictionary alloc] init]; [commonDict setObject:@([PKConfig vc]) forKey:@"vc"]; [commonDict setObject:[PKConfig vn] forKey:@"vn"]; [commonDict setObject:@"1" forKey:@"build"]; [commonDict setObject:[PKConfig uuid] forKey:@"uuid"]; [commonDict setObject:[PKConfig imei] forKey:@"imei"]; [commonDict setValue:[PKConfig os] forKey:@"os"]; [commonDict setObject:[PKConfig ch] forKey:@"ch"]; [commonDict setObject:[PKConfig osSdk] forKey:@"osSdk"]; [commonDict setObject:[PKConfig caller] forKey:@"caller"]; [parameters setObject:commonDict forKey:@"common"]; // Param [parameters setObject:paramDict forKey:@"param"]; //……