Ошибка скрипта Post_Install - PullRequest
       9

Ошибка скрипта Post_Install

0 голосов
/ 29 августа 2018

Мне нужно добавить скрипт post_install в мой проект из-за ошибки:

примечание: компиляция как Swift 3.3.2 с ActiveLabel, построенной как Swift 4.1.2 (это поддерживается, но может вызвать дополнительные проблемы с компилятором)

Я добавил предлагаемое решение от 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

мой Подфайл выглядит так:

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

У меня ошибка с консоли:

[!] Неверный Podfile файл: синтаксическая ошибка, неожиданный tIDENTIFIER, ожидаемый ключевое слово_then или ';' или '\ n' ... et.name == 'ActiveLabel' target.build_configurations.each do ... ... ^.

Что не так с этим синтаксисом? common_dependencies просто инициализировать все модули.

Ответы [ 3 ]

0 голосов
/ 29 августа 2018

Я думаю, что вам не хватает части установки модуля.

Ваш podfile должен выглядеть так:

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

Надеюсь, это поможет.

0 голосов
/ 29 августа 2018

Альтернативное решение «ActiveLabel». Используйте UITextView в качестве метки, например:

class UIDataDetectorLabel: UITextView {

    override func awakeFromNib() {
        super.awakeFromNib()

        self.isEditable = false
        self.dataDetectorTypes = UIDataDetectorTypes.all;
        self.isScrollEnabled = false
    }
}

Используйте этот класс:

@IBOutlet weak var labelDescription: UIDataDetectorLabel!

И

self.labelDescription.attributedText = "here Attributted text here which contain phone, email..."

enter image description here

0 голосов
/ 29 августа 2018

Попробуй это. Надеюсь, что это решит вашу проблему

 target 'Name' do
        use_frameworks!
        common_dependencies()
    end # this end is missing in your code

    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
...