首页 > 解决方案 > 在 iOS 中为 Today Extension(Widget) 安装 pod

问题描述

如何在我的应用程序中为也称为 Widget 的扩展安装 pod。我已经为我的应用程序目标安装了该 pod。

我在网上查看过,我发现的解决方案让我出现了屏幕截图中的错误。

在此处输入图像描述

以下是我的 pods 文件中的代码:

platform :ios, '9.0'
use_frameworks!

target 'myapp' do
    pod 'Alamofire', '~> 4.8.0'
end

target 'myapp_extension' do
  pod 'Alamofire', '~> 4.8.0'
end



Multiple commands produce '/Users/abc/Library/Developer/Xcode/DerivedData/myapp-hitzznvtnviylfcammkfaxjvlryg/Build/Products/Debug-iphonesimulator/myapp.app/Frameworks/nanopb.framework':
1) That command depends on command in Target 'myapp' (project 'myapp'): script phase “[CP] Embed Pods Frameworks”
2) That command depends on command in Target 'myapp' (project 'myapp'): script phase “[CP] Embed Pods Frameworks”

标签: iosswiftwidgetcocoapodstoday-extension

解决方案


您可以使用inherit! :search_paths将相同的 pod 添加到您的扩展

platform: ios, '9.0'

target 'myapp' do
    use_frameworks!
    pod 'Alamofire', '~> 4.8.0'

    target 'myapp_extension' do
        inherit! :search_paths
    end

end

推荐阅读