iosrubyautomated-deployfastlane

iOS Create .h file by script, build and upload automatically


Every time, when I want to upload to App Store or hockey, I need to make sure my project setting are correct or not. I need to change in Common.h for which server I want to connect.

#define ENV_DEV     0x1
#define ENV_STAGING 0x1 << 1
#define ENV_PROD    0x1 << 2
#define ENV ENV_DEV

It is tedious and we need to have automated approach.

https://github.com/fastlane/fastlane
https://github.com/nomad/shenzhen

I already found those 2 and it is perfect. Building & uploading is automated already.

$ ipa distribute:hockeyapp -a API_TOKEN

1) how can I change my Common.h by script (may be override with the one from server? or create again by script?)

2) If I got that script, how can I combine together with fastlane or any other script so that I don't need to run twice?


Solution

  • Your best bet is to just have the environment defined in the preprocessor build setting rather than in code.

    Then you can just create extra schemes "Debug", "Release" with the preprocessor set for each server in the build settings.

    Then just get Fastlane to build the scheme you want to release.