将 pod 包含在主目标中,而不包含在 WatchKit 扩展中

2023-12-26

我在当前项目中添加了 WatchKit 扩展。该项目使用Cocoapods0.36.1添加一些框架,但现在我想从 WatchKit 扩展项目中排除一些 pod。

WatchKit 扩展项目不需要我在正常目标中使用的很多框架,但在更改 Podfile 后我无法让 Cocoapods 正常工作。

I use use_frameworks!在我的 Podfile 中,但是运行后pod install我收到以下消息:

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler` to `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.debug.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.debug.xcconfig` in your build configuration.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler` to `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.release.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.release.xcconfig` in your build configuration.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler WatchKit Extension` to `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.debug.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.debug.xcconfig` in your build configuration.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler WatchKit Extension` to `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.release.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.release.xcconfig` in your build configuration.

我没有更改基本配置的任何设置,但我的 3 个目标中有 2 个具有正确的设置Pods.debug or Pods.release放。没有基础配置的是WatchKitApp.

我原来的 Podfile

platform :ios, '8.0'
use_frameworks!

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git'
pod 'CocoaLumberjack', '~> 2.0.0'
pod 'MagicalRecord', :git => "https://github.com/magicalpanda/MagicalRecord.git"
pod 'PureLayout'
pod 'UAProgressView'
pod 'UICKeyChainStore'
pod 'XLForm', git: '[email protected] /cdn-cgi/l/email-protection:xmartlabs/XLForm.git'
pod 'Classy', git: '[email protected] /cdn-cgi/l/email-protection:depl0y/Classy.git'
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod 'JBChartView', '~> 2.8.9'
pod 'RFQuiltLayout'
pod 'HUMSlider', '~> 1.0'
pod 'SwiftEventBus', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'

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

我修改过的 Podfile

这是我想从我的 WatchKit 项目中排除某些 pod 的地方。

platform :ios, '8.0'

use_frameworks!

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

link_with "HomeHandler", "HomeHandler WatchKit Extension"

pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git'
pod 'CocoaLumberjack', '~> 2.0.0'
pod 'MagicalRecord', :git => "https://github.com/magicalpanda/MagicalRecord.git"

pod 'UICKeyChainStore'

target :HomeHandler do
    pod 'XLForm', git: '[email protected] /cdn-cgi/l/email-protection:xmartlabs/XLForm.git'
    pod 'UAProgressView'
    pod 'Classy', git: '[email protected] /cdn-cgi/l/email-protection:depl0y/Classy.git'
    pod 'Reveal-iOS-SDK', :configurations => ['Debug']
    pod 'JBChartView', '~> 2.8.9'
    pod 'RFQuiltLayout'
    pod 'HUMSlider', '~> 1.0'
    pod 'SwiftEventBus', :git => 'https://github.com/depl0y/SwiftEventBus.git'
    pod 'PureLayout'
end

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

CocoaPods 输出的警告是由于两个 CocoaPods 目标试图链接到应用程序中的单个目标(不支持)。

也就是说,你有一个明确的目标HomeHandler and您也将无名目标链接到 HomeHandlerlink_with "HomeHandler", "HomeHandler WatchKit Extension".

我的建议是修改您的 Podfile,使其看起来如下所示:

platform :ios, '8.0'
use_frameworks!

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

def shared_pods
    pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git'
    pod 'CocoaLumberjack', '~> 2.0.0'
    pod 'MagicalRecord', :git => "https://github.com/magicalpanda/MagicalRecord.git"
    pod 'UICKeyChainStore'
end

target 'HomeHandler' do
    shared_pods
    pod 'XLForm', git: '[email protected] /cdn-cgi/l/email-protection:xmartlabs/XLForm.git'
    pod 'UAProgressView'
    pod 'Classy', git: '[email protected] /cdn-cgi/l/email-protection:depl0y/Classy.git'
    pod 'Reveal-iOS-SDK', :configurations => ['Debug']
    pod 'JBChartView', '~> 2.8.9'
    pod 'RFQuiltLayout'
    pod 'HUMSlider', '~> 1.0'
    pod 'SwiftEventBus', :git => 'https://github.com/depl0y/SwiftEventBus.git'
    pod 'PureLayout'
end

target 'HomeHandler WatchKit Extension' do
    shared_pods
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将 pod 包含在主目标中,而不包含在 WatchKit 扩展中 的相关文章

  • iOS 9.3 中的 KVO 被破坏

    这可能是 iOS 9 3 发行版 中的一个可怕的错误 添加单个观察者时 NSUserDefaults standardUserDefaults 我注意到响应方法 observeValueForKeyPath ofObject change
  • iOS 和 Firebase 自动续订订阅

    我的问题 我很难找到一种使用 Firebase 在 iOS 中安全管理自动续订订阅的方法 购买流程 User1 purchases a subscription 使用订阅标识符更新 Firebase 上 User1 的帐户 用于解锁内容 存
  • UICollectionViewCell 拖动预览的自定义视图

    我正在尝试实现一项功能 用户可以将一个集合视图单元格拖放到另一个集合视图单元格上 但是 我想完全更改运动中物体的预览 以匹配我的应用程序的视觉隐喻 该项目没有移动 该项目包含的东西正在移动 例如 假设我的collectionview单元格显
  • 如何在 iOS 中创建多行表格单元格?

    如何让第二个单元格扩展以适合文本而不是缩放文本 iOS 中有内置的方法可以做到这一点 还是我必须想出一些自制的解决方案 如果您查看 iOS 联系人应用程序 会发现有一个类似地址的框 但我找不到如何实现这一点 对于任何希望将来实现这一目标的人
  • 尽早检测有问题的 XIB 视图

    我的笔尖名称有一个拼写错误 当我推向导航控制器时 它在代码中被破坏了 弄清楚它并没有花太长时间 但我认为最好尽早断言格式良好 以便更容易弄清楚 问题是它不是零 它只是无法从笔尖正确地形成自己 在 initWithNib 之后是否有更好的断言
  • 如何获得 UICollectionView 的矩形

    我想在 UICollectionView 中找到节标题的框架 我对 UITableView 也有类似的情况 为此 我能够通过执行以下操作来获得其正确性 CGRect rect self tableView rectForHeaderInSe
  • 在 XCode 中本地化 HTML 文件

    我有一个本地化的 iOS 应用程序 我希望在其中包含一些本地化的 HTML 文件 我不知道该怎么做 目前 我的文件夹结构如下所示 myapp en lrproj Localizable strings fr lrproj Localizab
  • AST 文件格式错误或损坏

    我有一个问题 我不知道为什么会发生这种情况 但很可能是因为我错误地按了 移动到垃圾箱 到某些系统框架 我收到一条错误消息 AST 文件格式错误或损坏 找不到 AST 文件引用的文件 Users username myProject Quar
  • 在 for 循环中为元组赋值

    struct MIDIPacket 中有一个 UInt8 的元组 正常的赋值是这样的 import CoreMIDI let packet MIDIPacket packet data 0 0x02 packet data 1 0x5f 等
  • Swift 字典映射 - 闭包中的 init

    我有 Swift 字典 private var params String AnyObject 这包含查询项目 例如 lat 40 lon 100 我想将这本词典映射到NSURLQueryItem大批 我想让它 迅速 params map
  • watchOS 2 上的最大内存使用量?

    我没有找到任何有关 watchOS 2 中应用程序可用内存使用的信息 我目前正在为 watchOS 开发一个应用程序 并且在手表端使用 Core Data 当我将 189 个对象中的 166 个加载到数组时 应用程序崩溃 此时的内存使用量为
  • 在 Swift 中计算两个 CLLocation 点之间的方位角 [重复]

    这个问题在这里已经有答案了 我正在尝试计算仅 swift 代码中两个 CLLocation 点之间的方位 我遇到了一些困难 并假设这是一个非常简单的函数 堆栈溢出似乎没有列出任何内容 func d2r degrees Double gt D
  • 如何动态添加XCTestCase

    我正在为一个白标签项目编写 UI 测试 其中每个应用程序都有一组不同的菜单项 测试点击每个菜单项并截取屏幕截图 使用快车道快照 https docs fastlane tools actions snapshot 目前这一切都发生在一个内部
  • Textview 中心文本对齐 IOS 7

    void observeValueForKeyPath NSString keyPath ofObject id object change NSDictionary change context void context NSLog He
  • Objective-C 中 NSURL 为 null 而 NSString 是正确的

    我有一个NSString包含一个 url 以及当我分配时NSURL与NSString NSURL 输出 空 这是因为url中有一些非法字符 导致NSURL不编码就无法读取NSString包含网址 NSString u incomingUrl
  • SwiftUI 自动调整底部工作表的大小

    SwiftUI 有很多底部工作表的示例 但是它们都指定了使用 GeometryReader 工作表可以增长到的某种类型的最大高度 我想要的是创建一个底部工作表 其高度仅与其中的内容一样高 我使用首选项键提出了下面的解决方案 但必须有更好的解
  • ios swift 如何将默认语言设置为阿拉伯语?

    我正在开发一个有两种语言的应用程序 即英语和阿拉伯语 我用英语编写了该应用程序 然后用阿拉伯语本地化了该应用程序 更改语言时需要重新启动应用程序 我唯一的问题是 第一次安装应用程序时如何将默认语言设置为阿拉伯语 我尝试在编辑方案部分将语言设
  • 为什么我收到 com.facebook.sdk.login 错误 308?

    我正在使用 Xcode 7 0 在 iOS 9 0 2 上进行测试并使用 Facebook SDK 4 7 0 当我登录用户时 大多数时候一切都正常 但有时我不断收到此错误 但我不知道为什么 操作无法完成 com facebook sdk
  • Xcode 中的 Prefix.pch 文件是什么?

    许多开发人员正在向其中添加各种方便的宏Prefix pch 但我的问题是那是什么Prefix pch file 如果我删除它Prefix pch来自我的文件Xcode 那么我的应用程序会运行吗 或者会显示什么错误吗 或者它会在构建过程中崩溃
  • 在启动屏幕中执行代码已更新

    在原始启动屏幕中执行代码 https stackoverflow com questions 27642016 execute code in launch screen 现在默认的LaunchScreenXcode 项目中的文件已更改为

随机推荐