Question

I'm running WL 6.1 (6.1.0.01.20140310-1427) on a macbook air (latest OSX). I have a dojo hybrid application that I'm trying to connect to a remote WL server. When I generate an iOS app and I'm changing the address of the worklight server to a remote server. It does not change the address in the generated iOS code. The steps I follow are:

  1. Open the Build Settings and Deploy Target... On the hybrid app folder.
  2. Select the check box for Build the application to work with a different Worklight server.
  3. Put in the new server information and click OK
  4. Build all environments
  5. After the build is complete, I launch into xcode and look at the worklight.plist and Root.plist files.

At this point they are still referencing my local server. If I edit them to point to the remote server, then my app works. Since these files are regenerated every time you do a build this is not a valid solution.

To verify it is nothing in my app, I created a default dojo hybrid application. Performed the steps I listed above. When I launched into xcode, the Root.plist and worklight.plist still have the default local server information.

So here is the funny thing. I also have a win7 system running the same level of WL developer plugin. I perform the same steps and the worklight.plist file is updated correctly on windows, just not in osx. The only other difference is the win7 version is running jre 1.7_21 where the osx is running 1.7_51. Both are in 64-bit mode.

Was it helpful?

Solution

I believe the real difference between your Mac and Windows machines is step 5, where you "launch into xcode". If by that you mean that you are actually doing Run As > Xcode project, then see below. This option is available only in Mac and not in Windows.

This is the expected behavior in Worklight 6.0.0.x and 6.1.0.x.

If after changing the server address to a remote server (rather than the local development server) and building, and then selecting Run As > Xcode project, this will overwrite the server settings back to the local development server.

Run As > Xcode project does 3 actions:

  1. Build & deploy the app to the local Worklight Development Server
  2. Generate an Xcode project (this in turn overwrites worklight.plist back to use local server settings)
  3. Open the generated Xcode project in Xcode

So if you want to use the app with the remote server settings, then after changing the settings and build the app, either:

  1. Copy the .zip from the your-iphone\package folder
  2. Navigate in the filesystem to the iphone\native folder and double-click the .xcodeproj file to open the it straight in Xcode (like what Run As > Xcode project does)

For future releases of Worklight it is being considered to streamline the behavior so that no matter if you choose, local or remote server settings, Run As > Xcode project will always use the ones you've selected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top