Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocapods Post_Install script error

I need to add post_install script to my project because of error :

note: compiling as Swift 3.3.2, with 'ActiveLabel' built as Swift 4.1.2 (this is supported but may expose additional compiler issues)

I added suggested solution from GitHub:

post_install do |installer| 
    installer.pods_project.targets.each do |target| 
        if target.name == 'ActiveLabel' target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.1' end end end end

my Podfile looks:

target 'Name' do
    use_frameworks!
    common_dependencies()

post_install do |installer| 
    installer.pods_project.targets.each do |target| 
        if target.name == 'ActiveLabel' target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.1' end end end

end

I have error from console:

[!] Invalid Podfile file: syntax error, unexpected tIDENTIFIER, expecting keyword_then or ';' or '\n' ...et.name == 'ActiveLabel' target.build_configurations.each do... ... ^.

What is wrong with this syntax ? common_dependencies just init all pods.

like image 290
Laxsion12 Avatar asked Nov 26 '25 18:11

Laxsion12


1 Answers

I think you are missing the pod installation part here.

Your podfile should look like this :

target 'Name' do
    use_frameworks!
    common_dependencies()

    pod 'ActiveLabel'

end

post_install do |installer| 
  installer.pods_project.targets.each do |target| 
    if target.name == 'ActiveLabel' target.build_configurations.each do |config| 
      config.build_settings['SWIFT_VERSION'] = '4.1' 
    end 
  end 
end

Hope this helps.

like image 123
Amit Avatar answered Nov 29 '25 09:11

Amit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!