Can't use AFHTTPRequestOperationManager

冷暖自知 提交于 2019-12-12 08:23:03

问题


I got a problem when I'm using AFNetworking. I wrote this in my code:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

I do add those files in my project, and I also try pod them into my project like this. But the compiler still told me "use of undeclared identifier 'AFHTTPRequestOperationManager'". Someone can help me?

screenshot:screenshot


回答1:


In fact, it's because after AFNetworking 3.x, there is no AFHTTPRequestOperationManager any more. You should use AFHTTPSessionManager instead.




回答2:


Please check the profile - AFNetworking version

Change to

pod 'AFNetworking', '~> 2.5.4'

and use

import "AFHTTPRequestOperationManager.h"




回答3:


In Your View controller .h file add

#import <AFNetworking/AFHTTPRequestOperationManager.h>

And then check it



来源:https://stackoverflow.com/questions/33893706/cant-use-afhttprequestoperationmanager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!