久美子
久美子

Reputation: 121

Cocoapod spec: Unable to find other source ref for `Contents.json`

I want to add my Assets.xcassets into my pod, so I have added the following to my podspec

      s.source_files     = ['Classes/**/*.{h,m,swift,json,strings,xib,storyboard}']
      s.resource_bundles = {'mysystem' => 'Classes/Resources/Assets.xcassets'}

I keep getting this error after I do pod lib lint

    - ERROR | [iOS] unknown: Encountered an unknown error (Unable to find other source ref for `Contents.json` for target `mysystem`.) during validation.

Here is what it looks like inside of my resources folder

enter image description here

I have tried a lot of different other things instead but none worked:

  1. I replaced resources_bundles with
      s.resources = ['Classes/Resources/Assets.xcassets']
  1. I have also added xcassets to my source files
     s.source_files     = ['Classes/**/*.{h,m,swift,json,strings,xib,storyboard, xcassets}']

Upvotes: 2

Views: 4679

Answers (2)

Sergey Gamayunov
Sergey Gamayunov

Reputation: 688

The reason why this error can occur is that this Contents.json sits somewhere in source folder (that we specify in .podspec file).

You should double check that your source folder includes only code and nothing else.

Upvotes: 3

Sameer Nawaz
Sameer Nawaz

Reputation: 101

I got the exact same error. The solution is,

Move the assets from Source to it's parent folder.

Project Structure

enter image description here

And the podspec looks like this

s.ios.deployment_target = '13.0'

  s.source_files = 'Source/**/**'
  s.swift_version = '5.0'
  s.platforms = {
    "ios": "13.0"
  }
  
  s.resource_bundles = {
    'MotionToastView' => ['MotionToastView/**']
  }

Upvotes: 5

Related Questions