iOSAFNetWorking下同步异步请求-创新互联

//阻塞

创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于成都网站设计、网站建设、松原网络推广、小程序设计、松原网络营销、松原企业策划、松原品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;创新互联建站为所有大学生创业者提供松原建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com

- (User *)findUser:(NSNumber *)userID

{

    NSString *url = [NSString stringWithFormat:@"%@/s/account/find-user/",ServerBaseURL];

    NSMutableDictionary *requestParms = [[NSMutableDictionary alloc] init];

    [requestParms setObject:userID forKey:@"userId"];

    AFJSONRequestSerializer *requestSerializer = [AFJSONRequestSerializer serializer];

    NSMutableURLRequest *request = [requestSerializer requestWithMethod:@"POST" URLString:url parameters:requestParms error:nil];

    AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request];

    AFHTTPResponseSerializer *responseSerializer = [AFJSONResponseSerializer serializer];

    [requestOperation setResponseSerializer:responseSerializer];

    [requestOperation start];

    [requestOperation waitUntilFinished];

    NSDictionary *userInfo = [[requestOperation responseObject] objectForKey:@"user"];

    if (userInfo != nil) {

这里对结果处理

return xxxx

    }

    return nil;

}

//异步

    NSString *url = [NSString stringWithFormat:@"%@/s/account/signin/", ServerBaseURL];

    NSMutableDictionary *requestParms = [[NSMutableDictionary alloc] init];

//设置参数

    [requestParms setObject:loginName forKey:@"loginname"];

    [httpManager POST:url parameters:requestParms

              success:^(AFHTTPRequestOperation *operation, id responseObject) {

//成功

              } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

//失败

              }];

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享名称:iOSAFNetWorking下同步异步请求-创新互联
网页URL:http://scyanting.com/article/depodo.html