Phonegap - setting up debugging and release in xcode

How to pass various variables to javascript in a telephone conversation depending on whether xcode is configured for debugging or release? In particular, right now I want to be able to switch whether the application connects to my local dev server or to a real cloud server.

One option would be if javascript can simply determine what type of assembly is going on, then I can store both sets of URLs in .js code and select accordingly.

It would be somewhat better if there was a place to store different URLs in Xcode, for example, possibly in .plist or something like that - I am not very good at Xcode or Objective-C (thus, telephone delay ), so I don’t know if this is even normal practice.

Ideally, I can only do this with javascript and IDE configuration changes. If I need to change something in Objective-C, the answer should be very specific what to do.

+4
source share
1 answer

In Xcode, we have goals for every application. By default, you get one goal for each application.

Duplicate the target with the built-in parameter that you have in xCode. So, one for local testing, and the other for live mode. Here you can have both targets in release mode.

Each target in xCode has a separate .plist file for defining some parameters and yes, having a common code base. Now put your local server url in target_test plist and the real server url in target_live plist.

Your code should be read from the corresponding plist at runtime.

Take a look

+1
source

Source: https://habr.com/ru/post/1414023/


All Articles