Cocoa pods 0.38.2 AFNetworking 添加为扩展

Cocoa pods 0.38.2 AFNetworking add as Extension

我根据 的答案进行操作。一切正常,但现在我更新了 cocoa pods 并且看起来 "pod install" 没有为项目生成所有依赖项。

我发现,我需要将 "project" 更改为 "pods_project",但它仍然不起作用。

我做什么wrong\maybe我错过了什么?

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

看起来新的 Pods (0.38.2) 和 AFNetworking (2.5.4) 版本您不必执行 link 中描述的步骤来解决 AFNetworking 的问题。

  1. if target.name == "Pods-QuickAsd-AFNetworking"更改为if target.name == "AFNetworking"
  2. 删除由 pod init 命令创建的所有内容并从头开始重新执行所有 pods 初始化
  3. 运行 pod install 更新后的 Podfile
  4. 打开 .xcworkspace 文件,清理并重建项目

这对我有用。无需任何其他步骤。