您好,登錄后才能下訂單哦!
//阻塞
- (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) {
//失敗
}];
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。