Topic
12 replies Latest Post - ‏2012-09-28T16:53:40Z by helenasmith
EDF3_Steven_Creighton
43 Posts
ACCEPTED ANSWER

Pinned topic Worklight 5.0 - PhoneGap issues on iPhone

‏2012-09-18T15:26:49Z |
Hi all,

I first made a Worklight project on 4.2 and as soon as Worklight 5.0 became available I grabbed it. Ever since, I've had massive problems with PhoneGap. It simply will not work for me. I discovered that in Worklight 5.0 prototype.js was removed. Therefore, I've removed it from my project (as it was still present in my project as it was made on 4.2) and PhoneGap now works on the Android emulator. However, as soon as I attempt to use it on my iPhone/an iPhone simulator, clicking the same button to access the camera (in this instance) does absolutely nothing. There is no response from the button and I'm left to scratch my head.

I created a test Worklight project with the same PhoneGap functionality and it works without any problems. Now, how can that work but it won't work on mine? Is there still something left over from 4.2 that needs to be removed to allow PhoneGap to work? As the Xcode debugger for use with Worklight is appalling I am really lost in terms of pinpointing what the problem is, or indeed where the problem lies. Has anyone faced this issue? Does anyone have any suggestions?

Please help, I'm really stuck with this! The only thing I can think of is creating a Worklight 5.0 project from scratch and copying each individual file over and seeing if that resolves the problem. The only issue with that is that my current project is HUGE. This would take a long time so please suggest an alternative!

Thanks,

Steve
  • christianIBM
    christianIBM
    78 Posts
    ACCEPTED ANSWER

    Re: Worklight 5.0 - PhoneGap issues on iPhone

    ‏2012-09-18T15:30:52Z  in response to EDF3_Steven_Creighton
    One suggestion is that PhoneGap was renamed to Cordova from WL 4.2 to 5.0 and as a result function calls to PhoneGap.exec are know Cordova.exec. This might solve your camera issue. I also recommend using Weinre to debug javascript on the device to see what error is being thrown.

    -Worklight Development Team, iOS-Christian Linares
    • SystemAdmin
      SystemAdmin
      2327 Posts
      ACCEPTED ANSWER

      Re: Worklight 5.0 - PhoneGap issues on iPhone

      ‏2012-09-18T16:22:50Z  in response to christianIBM
      If upper-case 'Cordova' is undefined, you may want to try lower-case 'cordova' instead.

      For example, you can use:
      cordova.exec(...)

      Documentation:
      http://docs.phonegap.com/en/2.0.0/guide_plugin-development_index.md.html
      • christianIBM
        christianIBM
        78 Posts
        ACCEPTED ANSWER

        Re: Worklight 5.0 - PhoneGap issues on iPhone

        ‏2012-09-18T16:24:51Z  in response to SystemAdmin
        Actually, yes, it should be lowercase 'c' … I have verified this recently on 5.0.0.3

        -Worklight Development Team, iOS-Christian Linares
        • SystemAdmin
          SystemAdmin
          2327 Posts
          ACCEPTED ANSWER

          Re: Worklight 5.0 - PhoneGap issues on iPhone

          ‏2012-09-18T17:49:12Z  in response to christianIBM
          Thanks for double-checking Christian! It used to be upper-case Cordova back in the first version of Worklight v5, but it was changed later to lower-case cordova because that's how it is in Apache Cordova's documentation specifies it (http://docs.phonegap.com/en/2.0.0/guide_plugin-development_index.md.html).
          • EDF3_Steven_Creighton
            43 Posts
            ACCEPTED ANSWER

            Re: Worklight 5.0 - PhoneGap issues on iPhone

            ‏2012-09-18T19:14:28Z  in response to SystemAdmin
            Thank you for your helpful responses.

            I've never before seen Weinre. Can you give me an example of how you use it? I see you go to a page after inserting some javascript into your index files header, but I'm not sure how I'd go about that when inside the app. If you could give me an example that would be super.

            As for the suggestions with regard to phonegap changing to cordova in terms of its naming on Worklight, do I change all references to this? Or is there a specific config file that needs updating? If you could advise where this needs to be modified, that would be a great help.

            I'll have chance to try these suggestions tomorrow. I'll report back if I have further problems.
            • SystemAdmin
              SystemAdmin
              2327 Posts
              ACCEPTED ANSWER

              Re: Worklight 5.0 - PhoneGap issues on iPhone

              ‏2012-09-18T19:56:30Z  in response to EDF3_Steven_Creighton
              Maybe this is helpful:

              PhoneGap Day 2011 - Debugging Mobile Web Apps with Weinre by Pat Mueller
              http://www.youtube.com/watch?v=Kbdv9nU9ZDU
        • SystemAdmin
          SystemAdmin
          2327 Posts
          ACCEPTED ANSWER

          Re: Worklight 5.0 - PhoneGap issues on iPhone

          ‏2012-09-19T21:46:03Z  in response to christianIBM
          O how I wish I had seen this a day ago.

          Could someone open a defect to get Cordova changed to cordova in the docs? I'm looking at Module 9.3 – Android Development Using the Apache Cordova Plug-in, and have been pounding my head against the desk because it isn't working.
          • SystemAdmin
            SystemAdmin
            2327 Posts
            ACCEPTED ANSWER

            Re: Worklight 5.0 - PhoneGap issues on iPhone

            ‏2012-09-19T22:04:44Z  in response to SystemAdmin
            Done. Sorry for the head pounding David.

            Barbara Hampson, Manager, IBM Worklight
            • SystemAdmin
              SystemAdmin
              2327 Posts
              ACCEPTED ANSWER

              Re: Worklight 5.0 - PhoneGap issues on iPhone

              ‏2012-09-19T22:05:14Z  in response to SystemAdmin
              and by 'done' I mean I opened a defect to get this fixed.

              Barbara Hampson, Manager, IBM Worklight
              • EDF3_Steven_Creighton
                43 Posts
                ACCEPTED ANSWER

                Re: Worklight 5.0 - PhoneGap issues on iPhone

                ‏2012-09-20T11:38:02Z  in response to SystemAdmin
                Hi all,

                To solve this problem I created a brand new project and everything worked swimmingly. I tried everything I could think of with renaming items but I just had no luck. If anyone is in the same position as me with 4.2 projects, I'd recommend setting up a new project, although it is a real headache transferring all files across, at least it works!

                Thanks!
  • SystemAdmin
    SystemAdmin
    2327 Posts
    ACCEPTED ANSWER

    Re: Worklight 5.0 - PhoneGap issues on iPhone

    ‏2012-09-18T16:05:20Z  in response to EDF3_Steven_Creighton
    Steven,

    Also, don't know if you've already seen this, but migration information from 4.2 to 5.0 is available in Chapter 6 of the Developer Environment Installation Guide (development environment) and Appendix G of the Administration Guide (production environment). Both guides can be found here:

    https://www.ibm.com/developerworks/mobile/worklight/getting-started/documentation.html

    Barbara Hampson, Manager, IBM Worklight
  • helenasmith
    helenasmith
    2 Posts
    ACCEPTED ANSWER

    Re: Worklight 5.0 - PhoneGap issues on iPhone

    ‏2012-09-28T16:53:40Z  in response to EDF3_Steven_Creighton
    The following announcement has just been posted on the IBM Worklight announcements forum:

    IBM Worklight V5.0.0.3: updated Getting Started modules now available

    The following IBM Worklight Getting Started modules have been updated as follows:
    1. Module_08_3_-_iOS_Development_Using_the_Apache_Cordova_Plugin.pdf: updated slides 15-18 to correctly use 'cordova' instead of 'Cordova'. As raised on the development forum at http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14888662.
    2. Module_09_3_-_Android_Development_Using_the_Apache_Cordova_Plugin.pdf: updated slides 12-16 to correctly use 'cordova' instead of 'Cordova'. As raised on the development forum at http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14888662.

    The updated versions of these modules are dated "27 September 2012", on the front page.
    You can find these documents under the "Getting started with IBM Worklight" tab at www.ibm.com/mobile-docs.
    Helena Smith, IBM Worklight documentation