【问题标题】:Cocoa pods 0.38.2 AFNetworking add as ExtensionCocoa pods 0.38.2 AFNetworking 添加为扩展
【发布时间】:2015-08-01 13:05:27
【问题描述】:

我从https://stackoverflow.com/a/29335471/3628317 答案开始。一切都很好,但现在我更新了可可豆荚,看起来“豆荚安装”不会为项目生成所有依赖项。

我发现,我需要将“项目”更改为“pods_project”,但仍然无法正常工作。

我做错了什么\也许我错过了什么?

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

【问题讨论】:

    标签: ios afnetworking cocoapods


    【解决方案1】:

    看起来对于新的 Pod (0.38.2) 和 AFNetworking (2.5.4) 版本,您不必执行链接中描述的步骤来解决 AFNetworking 的问题。

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

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

    【讨论】:

    • 这不起作用:将为扩展程序和主要目标启用应用程序扩展模式。
    • 这是一个已知问题,尚无修复:github.com/CocoaPods/CocoaPods/issues/3794
    • 原来的问题不是关于扩展,而是关于扩展中的AFNetworking,所以情况完全不同。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-28
    相关资源
    最近更新 更多