草庐IT

ios - CocoaPod 规范 : Unable to find other source ref for Model. xcdatamodeld

coder 2023-09-24 原文

我正在尝试创建一个包含 CoreData 模型的 pod。我已按照提示使用 resourcesreserve_path。但是当我尝试使用 pod lib lint 对规范进行 lint 时,出现了一个我什至不明白的奇怪错误:

- ERROR | [iOS] unknown: Encountered an unknown error (Unable to find other source ref for /Users/rzolin/Projects/ArmorText/iOS-Pod-Test/SampleMessengerCocoapodFramework/SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld/Model.xcdatamodel/contents for target SampleMessengerCocoapodFramework.) during validation.

该规范基于几个子规范,这可能会使问题复杂化一些。到目前为止,在 Internet 上搜索也没有任何帮助。

有一个test spec复制错误,如果有人愿意看一下。

完整规范在这里:

Pod::Spec.new do |s|
    s.name             = 'SampleMessengerCocoapodFramework'
    s.version          = '0.2.0'
    s.summary          = 'some desc'

    s.description      = <<-DESC
    some desc
    DESC

    s.homepage         = 'http://www.example.com'
    s.license          = { :type => 'MIT', :file => 'LICENSE' }
    s.author           = { 'rzolin' => 'rzolin@gmail.com' }
    s.source           = { :git => 'https://github.com/rzolin/SampleMessengerCocoapodFramework.git', :tag => s.version.to_s }

    # Platform setup
    s.requires_arc = true
    s.ios.deployment_target = '8.0'

    s.default_subspec = 'Core'

    ### Subspecs
    s.subspec 'Core' do |cs|
        cs.dependency 'SampleMessengerCocoapodFramework/DataManagement'
        cs.dependency 'SampleMessengerCocoapodFramework/Networking'
    end

    s.subspec 'DataManagement' do |ds|
    ds.source_files = 'SampleMessengerCocoapodFramework/Code/DataManagement.h', 'SampleMessengerCocoapodFramework/Code/DataManagement/**/*'
      ds.resources = [ 'SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld', 'SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld/*.xcdatamodel' ]
      ds.preserve_paths = 'SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld'
    end

    s.subspec 'Networking' do |ns|
    ns.source_files = 'SampleMessengerCocoapodFramework/Code/Networking.h', 'SampleMessengerCocoapodFramework/Code/Networking/**/*.{h,m,swift}'
    end

    # s.resource_bundles = {
    #   'SampleMessengerCocoapodFramework' => ['SampleMessengerCocoapodFramework/Assets/*.png']
    # }

    # s.public_header_files = 'Pod/Classes/**/*.h'
    # s.frameworks = 'UIKit', 'MapKit'
    # s.dependency 'AFNetworking', '~> 2.3'
end

我试过问 question在 Cocoapods 中,但在此处被引用

如有任何帮助,我们将不胜感激!

最佳答案

我遇到了与您相同的问题和错误消息。 我想在我的 pod 中包含 .xcdatamodel。 这是我的解决方案:

  1. 在 source_files 中仅添加您的代码:

     s.source_files = 'MyPodDiR/**/*.{h,m,swift}'
    
  2. 将您的 xcdatamodel 路径添加为资源:

     s.resources = 'MyPodDir/CoreData/MyPodModel*.xcdatamodeld'
    

关于ios - CocoaPod 规范 : Unable to find other source ref for Model. xcdatamodeld,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45862061/

有关ios - CocoaPod 规范 : Unable to find other source ref for Model. xcdatamodeld的更多相关文章

  1. ruby - 如何验证 IO.copy_stream 是否成功 - 2

    这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下

  2. Ruby 文件 IO 定界符? - 2

    我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的

  3. Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting - 2

    1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里

  4. ruby - 为什么不能使用类IO的实例方法noecho? - 2

    print"Enteryourpassword:"pass=STDIN.noecho(&:gets)puts"Yourpasswordis#{pass}!"输出:Enteryourpassword:input.rb:2:in`':undefinedmethod`noecho'for#>(NoMethodError) 最佳答案 一开始require'io/console'后来的Ruby1.9.3 关于ruby-为什么不能使用类IO的实例方法noecho?,我们在StackOverflow上

  5. ruby - gem 规范失败 - 2

    我正在为毕业设计开发GEM,TravisCI构建不断失败。这是我在Travis上的链接:https://travis-ci.org/ricardobond/perpetuus/builds/8709218构建错误是:$bundleexecrakerakeaborted!Don'tknowhowtobuildtask'default'/home/travis/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in`eval'/home/travis/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_

  6. ruby - 如何禁止在 RSpec 中显示挂起(跳过)的规范? - 2

    我有几个跳过的规范。Pending:(Failureslistedhereareexpectedanddonotaffectyoursuite'sstatus)1)...#Notyetimplemented#./spec/requests/request_spec.rb:22如何抑制未决规范的输出? 最佳答案 您可以添加以下配置选项以从运行中过滤掉所有待处理的规范:RSpec.configuredo|config|config.filter_run_excludingskip:trueend此外,here是一个更详细的抑制输出的建议

  7. ruby-on-rails - 从帮助器规范中 stub 一个帮助器方法 - 2

    我正在构建Rails应用程序并使用RSpec制定测试。我为我正在创建的名为current_link_to的方法编写了测试。此方法应该检查当前页面是否对应于我传递给它的路径,并将current类添加到生成的链接中,以防它匹配。这是规范:require"spec_helper"describeApplicationHelperdodescribe"#current_link_to"dolet(:name){"Products"}let(:path){products_path}let(:rendered){current_link_to(name,path)}context"whenthe

  8. ruby - 为 IO::popen 拯救 "command not found" - 2

    当我将IO::popen与不存在的命令一起使用时,我在屏幕上打印了一条错误消息:irb>IO.popen"fakefake"#=>#irb>(irb):1:commandnotfound:fakefake有什么方法可以捕获此错误,以便我可以在脚本中进行检查? 最佳答案 是:升级到ruby​​1.9。如果您在1.9中运行它,则会引发Errno::ENOENT,您将能够拯救它。(编辑)这是在1.8中的一种hackish方式:error=IO.pipe$stderr.reopenerror[1]pipe=IO.popen'qwe'#

  9. ruby - IO::EAGAINWaitReadable:资源暂时不可用 - 读取会阻塞 - 2

    当我尝试使用“套接字”库中的方法“read_nonblock”时出现以下错误IO::EAGAINWaitReadable:Resourcetemporarilyunavailable-readwouldblock但是当我通过终端上的IRB尝试时它工作正常如何让它读取缓冲区? 最佳答案 IgetthefollowingerrorwhenItrytousethemethod"read_nonblock"fromthe"socket"library当缓冲区中的数据未准备好时,这是预期的行为。由于异常IO::EAGAINWaitReadab

  10. ruby-on-rails - 在 RSpec 中编写请求规范的正确方法是什么? - 2

    tl;dr:跳到最后一段最近一直在尝试使用RSpec的requestspecs做一些更有针对性的测试。我的测试主要是这样的:通用cucumber功能规范,即用户转到带有评论的帖子,对评论点赞,作者获得积分modelspecs当模型实际上具有某些功能时,即User#upvote(comment)controllerspecs我在其中stub了大部分内容,只是试图确保代码按照我期望的方式运行viewspecs当View中有一些复杂的东西时,例如仅在用户尚未投票时呈现upvote链接,这些被stub为好吧问题是当我有一些导致错误的特定场景时,一切似乎都在我无法重现它的模型/View层中工作。

随机推荐