【问题标题】:Cocoapods : Issue with pod which contains resource folder Assets.xcassetsCocoapods:包含资源文件夹 Assets.xcassets 的 pod 出现问题
【发布时间】:2020-02-04 09:47:13
【问题描述】:

我正在创建自己的 cocoapods。我收到一个错误,如屏幕截图所示。我认为,Assets.xcassets 文件夹链接存在一些问题。如果 assets.xcassets 文件夹中没有图像,则它没有问题。当我在资产中添加任何图像时,将针对这些图像自动生成 content.json,然后开始出现以下问题。

【问题讨论】:

    标签: ios json swift xcode cocoapods


    【解决方案1】:

    我已经修改了这两行,现在它可以工作了。

    s.source_files = 'ECGame/**/*.{swift, plist}' s.resources = 'ECGame/**/*.{storyboard,xib,xcassets,json,png}'

    【讨论】:

      【解决方案2】:

      您可以使用以下 YourPod.podspec 文件进行细微更改

      Pod::Spec.new do |s|
          s.name             = 'YourPod'
          s.version          = '0.1.0'
          s.summary          = 'Pod summary here'
          s.description      = 'Use description here and it must be larger than summary'
          s.swift_version = '4.2'
          s.homepage         = 'https://github.com/githubusername/YourPod'
          s.license          = { :type => 'MIT', :file => 'LICENSE' }
          s.author           = { 'Vipin' => 'vipintnk11@gmail.com' }
          s.source           = { :git => 'https://github.com/githubusername/YourPod.git', :tag => s.version.to_s }
          s.ios.deployment_target = '11.0'
          s.source_files = 'ECGame/**/*.{swift, plist}'
          s.resources = 'ECGame/**/*.{png,jpeg,jpg,storyboard,xib,xcassets,json}'
          s.framework = "UIKit"
          s.dependency 'MBProgressHUD'
          s.dependency 'Alamofire'
      end
      

      【讨论】:

        【解决方案3】:

        你要么做:

        s.subspec 'Resources' do |resources|
            resources.resource_bundle = {'ECGame' => ['Resources/**/*.{json,png}']}
        end
        

        或者你这样做:

        s.resources = "ECGame/Assets/*.xcassets"
        

        【讨论】:

        • 非常感谢。我如下所示,现在它正在工作 s.source_files = 'ECGame/**/*.{swift, plist}' s.resources = 'ECGame/**/*.{storyboard,xib,xcassets,json,png}'
        【解决方案4】:

        我有与 Vipin 相同的解决方案,只是稍作修正。

        s.source_files = 'RepoName/**/*.{swift}'
        s.resources = 'RepoName/**/*.{storyboard,xib,xcassets,json,png, jpg, jpeg, plist}'
        

        我已从源文件中删除 plist 并添加到资源文件中。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-10-07
          • 2020-01-07
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多