xcode Cocoa podspec 和依赖路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32581986/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:49:12  来源:igfitidea点击:

Cocoa podspec and path for dependency

xcodecocoapodspodspec

提问by Danilo

how can I specify in podspec a local path for an dependency ?

如何在 podspec 中指定依赖项的本地路径?

like : s.dependency 'MyLibrary', :path => '../MyLibrary'

像:s.dependency 'MyLibrary', :path => '../MyLibrary'

thanks

谢谢

采纳答案by Loegic

You should use the :pathkeyword in your Podfile:

您应该:path在您的Podfile:

pod 'AFNetworking', :path => '~/Documents/AFNetworking/AFNetworking.podspec'

Tips: If you don't know the path, you can drag & drop the file in your Podfileand it will display it.

提示:如果您不知道路径,可以将文件拖放到您的文件中Podfile,它会显示出来。

EDIT

编辑

I did not understand correctly what the OP was asking for, here is the correct answer:

我没有正确理解 OP 的要求,以下是正确答案:

  1. Put the local dependency inside your pod's folder root directory,
  2. In your Podspec file, just add s.ios.dependency 'YourPodName/YourPodDependencyFolder'
  1. 将本地依赖项放在 pod 的文件夹根目录中,
  2. 在您的 Podspec 文件中,只需添加 s.ios.dependency 'YourPodName/YourPodDependencyFolder'

After that, create a subspace like so:

之后,像这样创建一个子空间:

s.subspec 'YourPodName' do |ss|
ss.source_files = 'YourPodName/**/*.{h,m}'
end

回答by Danilo

I dont can put the other libraries in the root of my library, these are inside the parent because are shared with other project, but unfortunately without use the pods, and I'm trying to use the pods for all, and I already configured the podspec for all libraries.

我不能将其他库放在我库的根目录中,这些在父级内部,因为与其他项目共享,但不幸的是没有使用 pod,我正在尝试为所有人使用 pod,并且我已经配置了所有库的 podspec。

I'm trying to do something like this written below, but do not appear to work:

我正在尝试执行如下所示的操作,但似乎不起作用:

Pod::Spec.new do |s|
    s.name                  = 'MyLibrary'
    s.platform              = 'ios'
    s.ios.deployment_target = '7.1'
    s.source_files          = 'Classes/**/.{h,m}'
    s.resource              = 'Classes/resources/*.*'
    s.requires_arc          = true
    s.dependency 'AFNetworking'
    s.dependency 'SharedLib'

    s.subspec 'SharedLib' do |ss|
        ss.source_files         = '../SharedLib/Classes/**/*.{h,m}'
        s.resource              = '../SharedLib/Classes/resources/*.*'
        ss.ios.framework        = 'AVFoundation'
    end
end

thanks for all.

谢谢大家。