Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
14 replies Latest Post - ‏2012-07-03T15:49:48Z by jeffmil
SystemAdmin
SystemAdmin
570 Posts
ACCEPTED ANSWER

Pinned topic [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

‏2012-03-01T14:15:04Z |
Hi Worklight. This is a great set of tools. I have successfully used Eclipse on the Mac (OS X 10.7.x) to build the sample HelloWorklightApp, and deployed it out to Xcode, from where it builds and executes in the iPhone Simulator just fine. When I used my actual iPhone as the target, the app deploys and starts, but the full screen Worklight splash screen remains up and the small message screen never shows. If I look at the app's threads there is one that is paused. Eventually the app just dies.

I am relatively new to Xcode but I am guessing that this might be caused by the app not being able to check in with the Worklight server, which I think it does, right? My Worklight server is also running on the same Mac to which my iPhone is connected via USB. How do I solve this? Have you seen it before? Is there somewhere I need to set a URL and how would the iPhone find that, in any case?

And, specifically for iOS, since the app is deployed by Xcode directly to the device, what are the functions served by the Worklight Server in this configuration?

Thanks, - Jeff
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-01T14:31:02Z  in response to SystemAdmin
    Hi Jeff!
    Thank you for the kind words. :)

    Firstly,
    Could you please copy/paste the log from the Xcode Console?
    This will (hopefully) shed light on where exactly the app hangs during launch.

    1. The function of the Worklight Server in this configuration is basically the same as if in Production (where the application is also deployed to the App Store for consumers to download) - to serve requests by/to the application.

    2. Are you behind any firewall/proxy/etc? The device and server have to be in the same network internally, or both accessible publicly.

    You can try loading the Worklight Console from Safari Mobile to check this: visit http://localhost:8080/console

    In the application-descriptor.xml file of the application (sitting under your <project>/<application>), there is a setting called worklightRootURL, where we define what is the address the application should connect to; this is by default your local IP address.

    3. What are your installed Xcode and iOS SDK versions?

    In general there is a setting to change in Xcode for applications to be deployed correctly.
    Please go over the following instructions just in case: viewtopic.php?f=17&t=356
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-01T15:46:54Z  in response to SystemAdmin
    Hi Idan. Thank you for the exceptionally fast response. First, from my iPhone, using Safari, I can get to the Worklight console running on my Mac using the hardcoded ip:port/console URL. That works. And the Worklight sample app works fine in my Xcode iPhone simulator.

    Here is the Xcode log, that I can find. (Not an expert, though, so there might be more. There is another short log for the build that says it was successful, and there are no errors.)
    =======
    GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul 1 10:53:44 UTC 2011)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".tty /dev/ttys003
    target remote-mobile /tmp/.XcodeGDBRemote-43523-55
    Switching to remote-macosx protocol
    mem 0x1000 0x3fffffff cache
    mem 0x40000000 0xffffffff none
    mem 0x00000000 0x0fff none
    Switching to process 11523 thread 0x0
    Switching to process 11523 thread 0x0
    sharedlibrary apply-load-rules all
    warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/info/dns.so (file not found).
    warning: No copy of dns.so found locally, reading from memory on remote device. This may slow down the debug session.
    Switching to process 12803 thread 0x0
    2012-02-29 14:44:24.488 HelloWorklightApp20733:307 URL file:///var/mobile/Applications/D03609F9-DA70-4683-9DD7-95D9704BF870/Documents/www2004535307/skinLoader.html?skinName=(null)&wlFreeSpace=6138531840
    2012-02-29 14:44:26.168 HelloWorklightApp20733:307 Device initialization: DeviceInfo = {"name":"jeffmil’s iPhone","uuid":"6f56100d7ebb076017a065f7ab9c142e01eca536","platform":"iPhone","gap":"1.2.0","version":"4.2.1","connection":{"type":"wifi"}};
    2012-02-29 14:44:26.479 HelloWorklightApp20733:307 URL about:blank
    2012-02-29 14:44:26.605 HelloWorklightApp20733:307 URL gap://ready
    Switching to process 11523 thread 0x0

    kill
    quit
    ========
    I do see some threads during execution, and I see that one is paused. That could be there one trying to get back to the server?

    Or maybe I will try it with my phone offline and see if that makes a difference.... Just tried that, and I have the same problem - the splash screen just stays up, then eventually the entire app ends, never showing the little messages.

    Thanks,

    - Jeff
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-01T15:54:12Z  in response to SystemAdmin
    From the log it seems the app hangs before sending the first request to the server, even before the actual app initialization.

    Have you made any changes to the sample project or is this built with no changes? Could you please attach the project as a .zip just in case?
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-01T16:32:53Z  in response to SystemAdmin
    Hi Idan. I am amazed that you can see a problem spot in that log!

    I usually work on Windows so I'm not as facile with the Mac and Xcode. But I searched my Mac for HelloWorklightProject and found a few instances (and up to 10-12 copies of the associated CSS, HTML, etc. scattered in several directories by default, even though I only created 1 copy). So this attached instance is a zip of the one that when I sit in Xcode with the project open and I do a File > Show in Finder, this is the one that shows up. It's actually under my Eclipse workspaces but it's what Xcode points to.

    The project is unmodified, as far as I know, from the original sample. At least I never changed anything that I recall. Once again, it runs fine in the simulator but hangs on the actual iPhone, which is a 3G with whatever the most recent OS is supported by that model.

    Thanks,

    - Jeff
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-01T17:51:07Z  in response to SystemAdmin
    Right then, that was a question I intended to ask next...

    We currently we have a bug that happens with that family of hardware devices (ARM-6 based).
    AFAIK a fix is in the works. As for delivery, hard for me to answer at this moment, however I will get back to you on Sunday. Apologies.

    If you have a newer device such as iPhone 3GS, 4 or 4S, it will work Just Fine...
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-01T18:29:44Z  in response to SystemAdmin
    Thank you Idan. You are very conscientious! I appreciate your help. OK, good to know that it's not necessarily operator error. And for a bit of additional information

    1) I tried another Apple sample tutorial app that I had built and that does run properly on my phone
    2) I noticed the iOS target for HelloWorklightApp was set to iOS 3.0 and my phone has 4.2.1, so I changed the target to 4.2, did a rebuild, and the problem is still there
    3) I noticed in Settings that I can set a different URL for HelloWorklightApp, so I set that to Custom, which was already set to the proper Mac Worklight console URL, so that was also probably the default anyway. Changing that to Custom did not change the behavior.

    So, I appreciate all your help, and when a fix does appear, if you would please notify me here I will receive an email notification and I can try it again. I don't have a newer device unfortunately. I'm waiting for the iPad 3! :-) Real soon, now.

    Thanks very much,

    • Jeff
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-08T13:56:48Z  in response to SystemAdmin
    Hi Idan. Is there any word on whether there was a problem with the iPhone 3G hardware, and whether there is or will be a fix?

    Thanks,

    - Jeff
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-08T15:39:47Z  in response to SystemAdmin
    We have identified the issue; it should be fixed by time for our next release.
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-09T16:02:34Z  in response to SystemAdmin
    Thanks Idan. Please can you post here when that new build becomes available?

    And... do you have the capability to delete messages in this thread? Looks like we got spammed by a philosophical person from Poland. :geek:

    Thanks,

    - Jeff
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-09T18:51:25Z  in response to SystemAdmin
    Done.

    The new version will be announced on our website. I will see about post here about it in the future.
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-03-10T15:15:39Z  in response to SystemAdmin
    Thanks Idan. Don't worry about posting the announcement here. I'm sure you have plenty to do already. I'll watch the Web site for 4.2.1 or 4.3, or the next release.

    Thanks,

    - Jeff
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-04-27T16:31:58Z  in response to SystemAdmin
    Hi Idan. Just checking if you've heard anything about this fix. I heard we might not have an upgrade until mid-June. So perhaps you know of something sooner?

    Thanks, - Jeff
  • IdanAdar
    IdanAdar
    288 Posts
    ACCEPTED ANSWER

    Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

    ‏2012-04-29T05:59:02Z  in response to SystemAdmin
    The bug has indeed been fixed; the next release is scheduled for June 15th.
    • jeffmil
      jeffmil
      1 Post
      ACCEPTED ANSWER

      Re: [Solved] Need help - Xcode deployment to actual iPhone - sample app appears to hang?

      ‏2012-07-03T15:49:48Z  in response to IdanAdar
      Hi Idan. Indeed, the bug is fixed! That is great.

      I ran into 2 other build problems deploying to my iPhone 3G and here they are, with fixes for each:

      1) Related to a build error that causes the build to fail in Xcode, make these changes removing "atomic":

      • in Myproject > iPhone > native > Cordova.framework > Headers > CDVFileTransfer.h change

      @property (retain) NSMutableData* responseData;
      // @property (atomic, retain) NSMutableData* responseData;

      @property (assign) int responseCode;
      // @property (atomic, assign) int responseCode;

      There is no keyword atomic to use in a declared property. A property declared is by default behaving "atomic" so you don't have to set it explicitly. You just change the default behavior by adding nonatomic. As this is a compile time directive it is not needed to change this value during runtime, making "atomic" needless.

      2) And for another build error there is this fix: For this error for iPhone 3G "Command /usr/bin/lipo failed with exit code 1 error"

      • in Project > Build Settings > Architecture

      • change plain armv6 to Standard (armv6 armv7) - $(ARCHS_STANDARD_32_BIT)

      I can now deploy to my iPhone 3G.

      Thanks, - Jeff