search

Home  >  Q&A  >  body text

objective-c - cocoa pods error! undefined local variable or method

我在使用cocoa pods 的时候,出现下面的错误
[!] Invalid Podfile file: undefined local variable or method `afnetworking' for #<Pod::Podfile:0x007fa6c11591f8>. Updating CocoaPods might fix the issue.

关键是我不管导入什么第三方库都会出现这个,一直都导不进去

profile里面我只是写了
pod ‘sdwebimage’

也没有用到afnetworking,ruby环境重新装,cocoa pods 更新什么的都试过了,连mac的系统都更新了,还是不行,,就是不行!!!
求个大神帮我看看怎么回事

天蓬老师天蓬老师2758 days ago689

reply all(2)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:23:06

    The problem is not very clear. You can try to check your Podfile. The correct way is this:

    pod 'AFNetworking', '~> 2.5'
    

    Many people write their quotation marks like this

    pod ‘AFNetworking’, ‘~> 2.5′ 
    

    It’s best to use vim when editing files, give it a try. Be sure to follow the official format. For example:

    platform :ios, '9.0'
    

    Many people will add an extra space after:, which will also cause an error.

    reply
    0
  • PHPz

    PHPz2017-05-02 09:23:06

    No, no matter what I enter, I get an error
    [!] Invalid Podfile file: undefined local variable or method `afnetworking' for #<Pod::Podfile:0x007fa6c11591f8>. Updating CocoaPods might fix the issue.

    The key point is that no matter whether I import any framework or not, I always get an error saying that afnetworking is not found. When I import other frameworks, such as sdwebimage, I always get an error saying that afnetworking is not found.

    The afnetworking framework is not used, why do I always get an error and cannot find afnetworking?

    reply
    0
  • Cancelreply