Accessing user defined variables passed in from xcodebuild command line

后端 未结 3 945
不知归路
不知归路 2021-01-01 19:01

I am running my xctests using xcodebuild and need to pass in some environment variables. In the example below ACCOUNT_ID and HOS

3条回答
  •  时光取名叫无心
    2021-01-01 19:23

    So far I've only been able to get this approach to work:

    $ ACCOUNT_ID=foo HOST_URL=bar xcodebuild -project CalculatorTestClient.xcodeproj -scheme CalculatorTestClient clean test
    

    and accessed them via:

    NSDictionary *environment = [[NSProcessInfo processInfo] environment];
    NSString *accountID = [environment objectForKey:@"ACCOUNT_ID"];
    NSString *hostUrl = [environment objectForKey:@"HOST_URL"];
    

提交回复
热议问题