User Login With AFNetworking

后端 未结 3 1112
耶瑟儿~
耶瑟儿~ 2021-01-22 02:57

I am building my first iOS app.

I have got the backend code done, but I am struggling with the Objective-C part of it.

I have a signup / login page.

But

3条回答
  •  渐次进展
    2021-01-22 03:42

    Since I came here while searching for a working solution for AFNetworking 2.0, not knowing that AFHTTPClient was removed from the Framework, I will post the new way to establish this connection here:

    AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:@"http://examplewebsite.com"]];
    [manager setRequestSerializer:[AFHTTPRequestSerializer serializer]];
    [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"userName" password:@"password"];
    

提交回复
热议问题