Can't use AFHTTPRequestOperationManager

14,640

Solution 1

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

Solution 2

Please check the profile - AFNetworking version

Change to

pod 'AFNetworking', '~> 2.5.4'

and use

import "AFHTTPRequestOperationManager.h"

Share:
14,640
Hongxu Jin
Author by

Hongxu Jin

Updated on June 05, 2022

Comments

  • Hongxu Jin
    Hongxu Jin about 2 years

    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

  • Hongxu Jin
    Hongxu Jin over 8 years
    It said 'AFNetworking/AFHTTPRequestOperationManager.h' file not found.
  • Hongxu Jin
    Hongxu Jin over 8 years
    I added the screenshot.
  • Maulik Patel
    Maulik Patel over 8 years
    You remove class AFNetworking & Uikit + AFNetworking From your project on shown in first two. Only keep in pod
  • Hongxu Jin
    Hongxu Jin over 8 years
    @MaulikPatel It still doesn't work. you can see it in screenshot2 in my question. And if I add #import "AFHTTPRequestOperationManager.h", it still can't be found.
  • Hongxu Jin
    Hongxu Jin over 8 years
    Yes I am, you can see the pods in project navigator.
  • Maulik Patel
    Maulik Patel over 8 years
    It's very strange issue..Because in my all project every time i use AFNetworking & CocoaPod .But can't Face this problem .I just add Header file as i say in answer.Can you Share your basic project?
  • Hongxu Jin
    Hongxu Jin over 8 years
    Sure, may I send it to your mailbox?
  • Maulik Patel
    Maulik Patel over 8 years
    you have dropbox account?
  • Maulik Patel
    Maulik Patel over 8 years
    if yes then send me in dropbox
  • Hongxu Jin
    Hongxu Jin over 8 years
    I'm sorry I don't have one. So may I use mailbox?
  • Rushi trivedi
    Rushi trivedi over 8 years
    @Maulik Patel any solution? i have got same issue