0
我有webservice.But字符串時我添加字符串到NSMutableRequest,該方法返回成爲null.Here是我的代碼,NSMutableUrlRequest返回空值
-(NSMutableURLRequest *)createRequest:(NSString *)convertedString{
NSString *temp=[NSString stringWithFormat:@"%@%@",Api_Link,convertedString];
NSLog(@"%@",temp);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:temp]];
[request setHTTPBody:[convertedString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"App IPHONE" forHTTPHeaderField:@"USER_AGENT"];
[request setHTTPMethod:@"POST"];
return(request);
}
爲什麼添加()?退貨要求; – 2017-02-15 05:09:05
檢查它是否有值'[NSURL URLWithString:temp]' – Rajesh
@iDev我認爲他檢查'NSLog(@「%@」,temp)中的URL;' anad我認爲我們需要他如何調用這個方法的代碼的其餘部分,以及他在哪裏檢查它是「空」以知道他在做什麼 – 2017-02-15 05:13:38