首页 > 解决方案 > 获取 ios [Nativescript] 的新构建错误

问题描述

我开始为 ios 收到此构建错误

一切正常,然后我做了一个干净的构建并开始获取它。

有什么帮助吗?

Xcode build...
warning: Stale file '/Users/pandora/Projects/my-app/platforms/ios/build/sharedpch/SharedPrecompiledHeaders/11778268195216239247/ccsmobile-Prefix.pch.gch' is located outside of the allowed root paths.

warning: Stale file '/Users/pandora/Projects/my-app/platforms/ios/build/sharedpch/SharedPrecompiledHeaders/4227383043813640198/ccsmobile-Prefix.pch.gch' is located outside of the allowed root paths.

/Users/pandora/Projects/my-app/platforms/ios/Pods/Toast-Swift/Toast/Toast.swift:359:37: error: 'init(style:)' has been renamed to 'init(activityIndicatorStyle:)'
        let activityIndicatorView = UIActivityIndicatorView(style: .whiteLarge)
                                    ^                       ~~~~~
                                                            activityIndicatorStyle
UIKit.UIActivityIndicatorView:5:12: note: 'init(style:)' was introduced in Swift 4.2
    public init(style: UIActivityIndicatorViewStyle)
           ^
/Users/pandora/Projects/my-app/platforms/ios/Pods/Toast-Swift/Toast/Toast.swift:388:47: error: 'common' has been renamed to 'RunLoopMode.commonModes'
            RunLoop.main.add(timer, forMode: .common)
                                              ^~~~~~
                                              RunLoopMode.commonModes
Foundation.RunLoop.Mode:9:23: note: 'common' was introduced in Swift 4.2
    public static let common: RunLoopMode
                      ^
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
/Users/pandora/Projects/my-app/platforms/ios/Pods/MaterialShowcase/MaterialShowcase/MaterialShowcase+Calculations.swift:43:20: warning: result of call to 'insetBy(dx:dy:)' is unused
    expandedBounds.insetBy(dx: -expandedRadius, dy: -expandedRadius);
                   ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
** BUILD FAILED **

标签: nativescript

解决方案


如果您需要为插件设置特定的 Swift 版本...

在 App_Resources/iOS 文件夹中创建一个名为“Podfile”的文件

 post_install do |installer|
    installer.pods_project.targets.each do |target|
      puts "Pods target name :" + target.name
      if ['Toast-Swift'].include? target.name
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '5.0'
        end
      end
    end
  end

替换Toast-Swift为您的插件名称。


推荐阅读