Xcode using schemes to determine dev/staging/production server URLs

前端 未结 3 1885
自闭症患者
自闭症患者 2021-02-03 10:23

I wish to use Xcode\'s schemes to determine what server to run my app against. I have an app that fetches its information from a server. Like most people I have a development se

3条回答
  •  有刺的猬
    2021-02-03 10:44

    Use a key in the plist (for each schema, eg: URL_TO_USE), use define to create a 'shortcut' to get the value.

      #define MyURL [[NSBundle mainBundle] objectForInfoDictionaryKey:@"URL_TO_USE"]
    

    EDIT

    You must have multiple targets. Each target should point to a different .plist file. See: How to configure independent sets of runtime settings in XCode

提交回复
热议问题