2

Trying to build Xcode project (with cocoa pods) in Azure-Pipeline, but getting no such module despite selecting the workspace.

Tried building locally with commands, worked successful. Tried setting different variables in the yml, didn't help.

Using this command works locally but fails in azure

xcodebuild -sdk iphonesimulator -configuration Debug -workspace iosApp/iosApp.xcworkspace -scheme iosApp clean build

YML looks like this

  - script: /usr/local/bin/pod deintegrate
    workingDirectory: 'iosApp'
    displayName: 'pod deintegrate'

  - script: /usr/local/bin/pod install
    workingDirectory: 'iosApp'
    displayName: 'pod install'

  - task: Xcode@5
    inputs:
      actions: 'clean build'
      scheme: 'iosApp'
      sdk: 'iphonesimulator'
      configuration: 'Debug'
      workingDirectory: 'iosApp'
      xcWorkspacePath: 'iosApp/iosApp.xcworkspace'
      xcodeVersion: 'default'
      displayName: 'Building For iOS'

EDIT:

Still not working, however I realized that the module in question has a path associated with it, meaning it's local. i.e. pod 'Alamofire', :path => '~/Documents/Alamofire'

This could be part of the issue, since the other pods included seem to be working.

Kevin Schildhorn
  • 197
  • 2
  • 16

1 Answers1

4

This issue seemed be caused by the xcode task does not work on the correct workspace path.

You can try with updating the value of xcWorkspacePath to ProjectName.xcworkspace. Like the sample showed which modified from your scripts below:

- task: Xcode@5
    inputs:
      actions: 'clean build'
      scheme: 'iosApp'
      sdk: 'iphonesimulator'
      configuration: 'Debug'
      workingDirectory: 'iosApp'
      xcWorkspacePath: 'ProjectName.xcworkspace'
      xcodeVersion: 'default'
      displayName: 'Building For iOS'

Here has another reference: Build error in Xcode on cloud-hosted Mac on VSTS

Mengdi Liang
  • 17,577
  • 2
  • 28
  • 35
  • I don't believe this is the issue, because I have tried that in Azure and I get a different error of `The Xcode workspace was specified, but it does not exist or is not a directory`. I think the issue might be with the fact that the module in question is local and has a local path associated. – Kevin Schildhorn Jul 15 '19 at 14:36
  • Does the `pod install` script was executed and the `.xcworkspace` file is being compiled? – Mengdi Liang Jul 16 '19 at 06:17
  • I have the script task to `pod install`, which runs successfully according to the pipeline. – Kevin Schildhorn Jul 16 '19 at 12:24