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

  • Home
  • SEARCH
  • 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 7809547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:28:24+00:00 2026-06-02T03:28:24+00:00

I have ab iPhone application that makes heavy use of a Rails json API

  • 0

I have ab iPhone application that makes heavy use of a Rails json API I have built. Most of the time I am testing the local version of my API (URLs like localhost:3000/api/log_in), but I also need to test it on a remote server from time to time (URLs like someapp.com/api/log_in).

How can I easily switch the urls used by my application depending on whether I want to test against my local or remote server?

  • 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-02T03:28:27+00:00Added an answer on June 2, 2026 at 3:28 am

    Okay. You should go like this:

    1. Create another target (by copy the existing one)
      enter image description here

    2. Under Build Settings, change the Prefix Header to another filename
      enter image description here

    3. Create the new Prefix Header (just add a file or duplicate/add your existing Header Prefix File)
      enter image description here

    4. Add the same precompiler constant (#define) to both .pch file. One with your productive URL, one with your localhost URL. Instead of your “static” URL in your code, use the new set precompiler constant.

    5. Now you can switch between localhost/production with switching targets next to your run/stop buttons

    enter image description here

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

Sidebar

Related Questions

I have an iPhone application that makes use of an API. Among the API
I currently have an iPhone application that makes a call to an API to
I'm developing an iPhone application that makes heavy use of Core Data, primarily for
Greetings! I'm attempting to build an iPhone application that makes use of an iOS4-only
I have created an application that makes use of database. Can I use SQL
I have an iPhone Windows-based Monotouch application that appears to use more memory to
I have an iPhone application I've been using for some time that uses ASIHTTPRequest
I have an iPhone application that adds new contacts via the Address Book Framework.
I have an iPhone application that reads RSS feeds from a YouTube channel. However,
I have an iPhone application that send datas via wifi on my mac. I

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.