Search code examples
iosafnetworkingcocoapods

Cocoa pods 0.38.2 AFNetworking add as Extension


I make steps from https://stackoverflow.com/a/29335471/3628317 answer. And everything was ok, but now I updated cocoa pods and looks like "pod install" do not generate ALL dependency for projects.

I found, that I need to change "project" for "pods_project", but it's still not working.

What I do wrong\maybe I miss something?

platform :ios, "8.0"

use_frameworks!

def shared_pods
    pod 'AFNetworking'
end

target 'Asd', :exclusive => true do
    shared_pods
end


target 'QuickAsd', :exclusive => true do
    shared_pods
end


post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        if target.name == "Pods-QuickAsd-AFNetworking"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
    end
end

Solution

  • Looks like with new Pods (0.38.2) and AFNetworking (2.5.4) versions you don't have to do steps described in your link to fix a problem with AFNetworking.

    1. Change if target.name == "Pods-QuickAsd-AFNetworking" to if target.name == "AFNetworking"
    2. Remove all the stuff created by pod init command and re-do all pods initialization from scratch
    3. Run pod install with your updated Podfile
    4. Open .xcworkspace file, cleanup and rebuild project

    This worked for me. No any other steps needed.