如题啊该怎么弄?之前用asi的时候是这样的NSDictionary*sinaDBDictionary=[sinaDBArrayobjectAtIndex:0];NSString*accessTokenKey=[sinaDBDictionaryobjectForKey:@"AccessTokenKey"];NSString*wbUid=[sinaDBDictionaryobjectForKey:@"UserIDKey"];NSString*boundary=@"14745591349540787582088777204";//设置请求体中内容NSMutableString*bodyString=[NSMutableStringstring];[bodyStringappendFormat:@"-----------------------------%@\r\n",boundary];[bodyStringappendString:@"Content-Disposition:form-data;name=\"accessToken\"\r\n"];[bodyStringappendString:@"\r\n"];[bodyStringappendString:accessTokenKey];[bodyStringappendString:@"\r\n"];[bodyStringappendFormat:@"-----------------------------%@\r\n",boundary];[bodyStringappendString:@"Content-Disposition:form-data;name=\"wbUid\"\r\n"];[bodyStringappendString:@"\r\n"];[bodyStringappendString:wbUid];[bodyStringappendString:@"\r\n"];[bodyStringappendFormat:@"-----------------------------%@--\r\n",boundary];NSMutableData*bodyData=[[NSMutableDataalloc]initWithLength:0];NSData*bodyStringData=[bodyStringdataUsingEncoding:NSUTF8StringEncoding];[bodyDataappendData:bodyStringData];NSString*len=[NSStringstringWithFormat:@"%d",[bodyDatalength]];NSString*s=[NSStringstringWithFormat:@"multipart/form-data;boundary=---------------------------%@",boundary];NSString*url=@"屏蔽屏蔽屏蔽屏蔽掉";ASIFormDataRequest*request=[ASIFormDataRequestrequestWithURL:[NSURLURLWithString:url]];request.defaultResponseEncoding=NSUTF8StringEncoding;request.useCookiePersistence=YES;[requestsetRequestMethod:@"POST"];[requestaddRequestHeader:@"Content-Type"value:s];[requestaddRequestHeader:@"Content-Length"value:len];[requestsetPostBody:bodyData];[requeststartSynchronous];NSError*error=request.error;if(!error){//NSLog(@"%@",[requestresponseString]);}else{//NSLog(@"%@",[[requesterror]localizedDescription]);}真的是好复杂啊然后现在要转为afn了该怎么弄
湖上湖
相关分类