Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:24:49+00:00 2026-06-08T09:24:49+00:00

In my development I wish to hit a development URL when im testing but

  • 0

In my development I wish to hit a development URL when im testing but when the app is run on my iPhone, I want it to run on production URL. How do I get about setting this in Xcode?

Almost seems like I need to be able to set environmental variables (which in this case are different URLs).

Where do I set these up? Please hand hold me on the answer as I am fairly new

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:24:50+00:00Added an answer on June 8, 2026 at 9:24 am

    There are lots of ways to do this. My preferred method is to create a file called Constants.h that looks like this:

    //
    //  Constants.h
    //
    
    #ifndef Constants_h
    #define Constants_h
    
    #pragma mark - Instances
    #ifdef DEVELOPMENT
    #define ROOT_URL @"http://127.0.0.1:8000"
    #endif
    
    #ifdef STAGING
    #define ROOT_URL @"http://staging.example.com"
    #endif
    
    #ifdef PRODUCTION
    #define ROOT_URL @"http://production.example.com"
    #endif
    

    Then, I just include it in my *-Prefix.pch file like this:

    #ifdef __OBJC__
        #import <UIKit/UIKit.h>
        #import <Foundation/Foundation.h>
        #import "Constants.h"
    #endif
    

    In your build settings, set DEVELOPMENT, or STAGING, or PRODUCTION = 1.

    Now you can access things like ROOT_URL anywhere in your project.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m starting my development in Cocos2D and I wish to make this card effect
Starting iOS development, I wish to implement handwriting recognition in my app. I did
I am currently doing iphone development. I wish to do development in the Symbian
My app is in development and I do all my testing using WEBrick (I
I am a newbie for iphone development, i wish to show some list of
Firstly, I want to restrict this question to web development only. So this is
During development, I use this to load the latest jQuery: <script src=http://www.google.com/jsapi></script> <script type=text/javascript>
How do set up a Unix based VirtualBox guest for Java Development? I wish
hii. im just beginer in flex development. I wish to do projects in mvc
I've been doing web development for a few months now and keep having this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.