简体   繁体   English

Swift项目在一台机器上构建,但不在新Mac上构建

[英]Swift project build on one machine but not on a new mac

We have a Swift Project where we use fastlane as build tool and CocoaPods for dependency management. 我们有一个Swift项目,其中我们使用fastlane作为构建工具,并使用CocoaPods进行依赖项管理。 Everything works fine on the development machine. 在开发机器上一切正常。

If we checkout the project on our new build server Mac Mini, we get the following error: 如果我们在新的构建服务器Mac Mini上签出项目,则会收到以下错误:

/Applications/buildAgent/work/1e0861a2675353b6/Appname/AppDelegate.swift:10:8: could not build Objective-C module 'HockeySDK' /Applications/buildAgent/work/1e0861a2675353b6/Appname/AppDelegate.swift:10:8:无法构建Objective-C模块“ HockeySDK”

The same lane on our development machine works perfectly fine. 我们的开发机器上的同一通道工作正常。 What are we missing here? 我们在这里想念什么?

The XCode and Cocoapods Versions are the same on both machines. 两台机器上的XCode和Cocoapods版本相同。

I ran into same problem with a framework ' RealmSwift '. 我在框架“ RealmSwift ”中遇到了同样的问题。

For me the problem was. 对我来说,问题是。

Source control 源代码控制

Some of the files from frameworks were not included in the commit. 框架中的某些文件未包含在提交中。 I was using Xcode to commit & push the code. 我正在使用Xcode提交并推送代码。

If you are using git, check if some of the files are missing by running ' git status ' on the machine that has working copy of code. 如果使用的是git,请在具有工作代码副本的计算机上运行“ git status ”,以检查是否缺少某些文件。 Solution was to simply add the required missing files inside the project to git. 解决的办法是简单地将项目中所需的丢失文件添加到git中。

If that doesn't work you can try 如果这样不起作用,您可以尝试

Reinstalling the pods. 重新安装吊舱。

  1. Comment the frameworks in podfile. 注释 podfile中的框架。
  2. Run pod install . 运行pod install It shall remove all the pods . 它将所有豆荚移走
  3. Clean the pods cache . 清洁豆荚缓存
  4. Build the project from xcode . 从xcode构建项目 It will show lots of error for the missing frameworks. 对于缺少的框架,它将显示很多错误。 Close the Xcode. 关闭Xcode。
  5. Uncomment all the frameworks you commented in step 1. 取消注释您在步骤1中注释的所有框架。
  6. Run pod install again. 再次运行pod install Then clean & build the project. 然后清理并构建项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM