iOS Ionic Build

I have been struggling to get my iOS ionic project to build and deploy properly, so I have created a simple base project:

ionic start barcode-test --v2

This creates a simple ionic application shell with three tabs. I’ve installed one plugin:

ionic plugin add phonegap-plugin-barcodescanner

I created a yml file:

    ## Customize the test machine
machine:
    timezone:
        America/Denver # Set the timezone

    environment:
        XCODE_SCHEME: symbolicator
        XCODE_WORKSPACE: symbolicator

## Customize dependencies
dependencies:
    pre:
        - npm install -g typescript typings ionic cordova ios-sim ios-deploy
        - typings install
        - gem install fastlane -v 2.2.0

    post:
        - ionic platform add ios

## customize test commands
test:
    override:
        - ionic build ios

deployment:
    beta_distribution:
        branch: 'develop'
        commands:
            - fastlane ios beta build_number:$CIRCLE_BUILD_NUM
            - cp -R ./dist $CIRCLE_ARTIFACTS

I committed my code: https://github.com/briebugconsulting/barcode-test

I’ve made this branch public in hope that it can help others experiencing similar issues. I’m hoping that this can become part of the base documentation for the circleci when its all done.

Note: I have not included the platforms folders as this is not part of the actual source code.

The goals for this build include:

  1. Build on OSX platform
  2. Not complain about xcode scheme/workspace/project environmental variables.
  3. should install iOS and Android platforms
  4. install android sdk
  5. install fastlane
  6. deploy to test flight
  7. deploy to google play beta testing

When the build runs it fails to add the platform:

ionic platform add ios
function bold() { [native code] } https://github.com/driftyco/ionic-default-resources/archive/master.zip
Error: Current working directory is not a Cordova-based project.

I’m guessing this probably caused by using symbolicator in the environment section:

environment:
    XCODE_SCHEME: symbolicator
    XCODE_WORKSPACE: symbolicator

I saw someone else using symbolicator and it seemed to get me past the issue of not having a workspace or project to point at when the build is first started. I can ssh into the machine and run the same commands to add the platforms, and of course it works without issue.

Any ideas how how to make this work? I have checked in the entire platforms project folder in other projects, however, this seems so wrong and bloats the project unnecessarily. I just need to delay setting where the workspace/project folders will be until I can add the platforms. If I can get this to work then I believe the rest of it will be pretty simple as we have been able to build successfully to testflight with other projects.

Did you get this working? Pretty much trying to do the exact same thing.

Yes, we were able to get it to work. If you clone the barcodetest project locally and set the environmental variables on circle-ci, it should work for you.

1 Like

Another question for you. I see you are using fastlane match, have you been able to get that working? Is there any additional config needed? I have used it manually on my local machine, but I mean, is there additional config for circleci needed?