CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler

时间:2021-03-08 19:57:05   收藏:0   阅读:556

目前Swift的稳定版本是5.4

https://docs.swift.org/swift-book/index.html

XCode新建项目的build-setting中Swift Language Version 设置为 Swift5

近期在项目开发中使用到了swift,在本地可以正常编译运行项目,但是在jenkins打包的时候抛出如下错误。

分析总结这个问题,避免后面的同学被同一个问题困扰。

 

参考XCode更新文档

https://developer.apple.com/xcode/whats-new/

发现从XCode12以后才开始引入Swift5.3及以上版本

 

Swift5.3更新部分

 技术分享图片技术分享图片

         what‘s problem ?

         The following build commands failed:

             CompileSwift normal armv7 xxx.swift

             CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler

             CompileSwift normal arm64 xxx.swift

         

         why problem ?

         xxx.swift:24:10: error: consecutive statements on a line must be separated by ‘;‘

                 } completion: { _ in

                  ^

                  ;

         xxx.swift:24:21: error: expected expression

                 } completion: { _ in

                             ^

         xxx.swift:24:11: error: use of unresolved identifier ‘completion‘

                 } completion: { _ in

                   ^~~~~~~~~~

         xxx.swift:24:23: error: unable to infer closure type in the current context

                 } completion: { _ in

                               ^~~~~~

         xxx.swift:24:23: error: closure expression is unused

                 } completion: { _ in

         

         How fix ?

         // xcode12 and above

         UIView.animate(withDuration: 0.3) {

             // animation actions

         } completion: { _ in

             // some finished actions

         }

 

         // below xcode12

         UIView.animate(withDuration: 0.3, animations: {

             // animation actions

         }, completion: { _ in

             // some finished actions

         })

         

         不同版本XCode编译器在编译swift文件,做语法检查的时候,检测到该语法不支持。爆出这样的错误

原文:https://www.cnblogs.com/GOBAT/p/14501528.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!