Search code examples
iosswiftcocoapods

iOS file patterns: The `source_files` pattern did not match any file


I am trying to create a CocoaPod and when I try pod lib lint there's an error about ERROR | [iOS] file patterns: Thesource_filespattern did not match any file.

I am trying to follow BlinkingLabel pod as an example and using Gitlab for storage of my .git . I tagged it successfully 1.0.0 and it worked for it.

enter image description here

I used my CocoaPod in Example for Pod and its working but I got the error:

Ignoring unf_ext-0.0.7.5 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.5

 -> BlinkingLabel (1.0.0)
    - ERROR | [iOS] file patterns: The `source_files` pattern did not match any file.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')

[!] BlinkingLabel did not pass validation, due to 1 error.
You can use the `--no-clean` option to inspect any issue.

My source_file prop is:

s.source_files = 'BlinkingLabel/Classes/**/*'

But I've tried it with:

s.source_files  = "BlinkingLabel/**/*"



s.source_files = 'BlinkingLabel/BlinkingLabel.swift'



s.source_files = 'BlinkingLabel/Classes/**/*.{h,m,c}'

No one has worked for me in lint.

And there's a strange thing.

In the article and examples it recommended to use with BlinkingLabel/Classes/**/* but there's nothing any directory as named Classes in BlinkingLabel, I guess because of new update of CocoaPod or maybe something is different in new CocoaPod. Can you explain this?

And how to solve this problem for pod lib lint at all?

Edit: I've searched over stackoverflow but nothing work for me.

Thanks in advance.


Solution

  • For anyone who stuck at - ERROR | [iOS] file patterns: Thesource_filespattern did not match any file., do not use source_files like below.

    s.source_files = 'BlinkingLabel/Classes/**/*'
    

    Use it with your inner directory name and exact file type.

    For example if you have a Handler.swift file it must be.

    s.source_files = 'Classes/**/*.swift'
    

    If you have any .c file in your pod project that used

    s.source_files = 'Classes/**/*.c'
    

    or you can mix it with different file types.

    Further I realized that the you must not trust to Classes directory.

    You can create a Sources directory and can add all your source files into it and then you can try it with

    s.source_files     =   'Sources/**/*.swift'
    

    This is the exact solution for me.

    I hope it helps for anyone who stuck at.