“ERROR: Unexpected action: build” when building a project with Swift 3 and Cocoapods on Travis-CI

我怕爱的太早我们不能终老 提交于 2019-12-04 16:20:27

问题


Evening/morning/afternoon all,

Been hitting my head over this for a bit now and couldn't find anything online about this so my best bet is here.

When Travis-CI builds my project I get the following error:

 xctool -workspace Project.xcworkspace -scheme ProjectTests build test

 ERROR: Unexpected action: build

and here is my config:

language: objective-c
xcode_workspace: Project.xcworkspace
xcode_scheme: ProjectTests
osx_image: xcode8.2

Perhaps I missed something in the tutorial? I got a little lost on the pods dependency section but I believe I did it right. This happens with a new scheme (ProjectTests) created and with the original scheme (Project). I added the dependencies for the ProjectTests scheme in the Build phase like it said but still no dice. Any ideas?


回答1:


Figured it out (at least in my situation) xctool wasn't working so I used xcodebuild instead and it worked. Here is what I put in:

script:
    - xcodebuild clean build -sdk iphonesimulator -workspace Project.xcworkspace -scheme ProjectTests CODE_SIGNING_REQUIRED=NO



回答2:


App (build + run)

language: objective-c
osx_image: xcode8.3

script: xcodebuild clean && xcodebuild build -sdk iphonesimulator10.1 -project yourproject.xcodeproj -scheme yourscheme CODE_SIGNING_REQUIRED=NO

Framework (build only)

language: objective-c
osx_image: xcode8.3

script: xcodebuild clean && xcodebuild build -project yourproject.xcodeproj -scheme yourscheme

Use && to daisy chain commands and only build if clean succeeds.




回答3:


// Step-1: Check your SDK version

$ xcodebuild -showsdks

// Step-2: The following .travis.yml file works for me

language: objective-c
osx_image: xcode9.3
script: xcodebuild clean && xcodebuild build -sdk iphonesimulator11.3 -project MovingHelper.xcodeproj -scheme MovingHelper CODE_SIGNING_REQUIRED=NO



回答4:


The reason for the problem is that xctool deprecated the support for "build"

https://github.com/facebook/xctool

Note: Support for building projects with xctool is deprecated and will not be updated to support future versions of Xcode. We suggest moving to xcodebuild (with xcpretty) for simple needs, or xcbuild for more involved requirements. xctool will continue to support testing (see above).



来源:https://stackoverflow.com/questions/41786984/error-unexpected-action-build-when-building-a-project-with-swift-3-and-cocoa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!