我正在使用一种方法来调用 Web 服务并在服务器上上传转录音频文件。方法如下:
- (NSDictionary *)UploadTranscriptionAudio:(NSString *)uploadfor forPN_ID:(NSString
*)pn_id forTaskFlag:(NSString *)taskflag documentPath:(NSString *)documentpath
forUserName:(NSString *)username file_path_msd:(NSString *)file_path_msd
audioFilePath:(NSString *)audiofilepath{
NSDictionary *response = nil;
NSURL * url = [NSURL URLWithString:[AppDelegate sharedInstance].str_webServiceUrl];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:uploadfor forKey:@"Uploadfor"];
[request setPostValue:pn_id forKey:@"PNID"];
[request setPostValue:taskflag forKey:@"task_flag"];
[request setPostValue:documentpath forKey:@"Path"];
[request setPostValue:username forKey:@"Username"];
[request setPostValue:file_path_msd forKey:@"file_path_msd"];
[request setFile:audiofilepath forKey:@"uploadedfile"];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
response = (NSDictionary*)[request responseString];
NSLog(@"Response = %@",response);
return response;
}
return response;
}
这个方法仍然返回我一个 NSstring 作为响应。我想要的是这个方法应该给我一个 NSDictionary。因为我必须在其他地方使用该字典中键的值。有人可以帮我解决这个问题。