2

I have created a ruby on rails responsive web application, I wanted to try and use this code to develop a native iOS app and possibly an android app using Phonegap. I followed this tutorial https://www.youtube.com/watch?v=LjIKElAP6_A in an attempt to use my app on my iPhone. When I follow the tutorial and run the app on my iPhone I just get a blank screen.

I used the following commands to set up my phone gap app:

phonegap create myappios com.testrails.myappios Myiosapp
phonegap platform add ios
cordova plugin add org.apache.cordova.console
cordova plugin add cordova-plugin-device

I then used the following code in my index.html file within the phone gap app:

<html>
<head>
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script type="text/javascript">

        function onBodyLoad()
        {
            document.addEventListener("deviceready", onDeviceReady, false);
            window.location.href = " http://localhost:3000/"
        }
        function onDeviceReady
        {
            //do your thing
        }
    </script>
    <script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>

</head>
<body onload="onBodyLoad()">

</body>
</html>

Followed by the command: phonegap build iOS.

I just get a blank screen when the app is opened on my phone. I think the tutorial I followed is outdated, or maybe I have done something wrong. Can anybody see any blatant errors above? I have also looked into using Sencha and appcelerator but I'm not really sure what my best option here is.

Jarvey
  • 75
  • 8
  • between the body tag, can you put some text there to check if your web view is probably loaded? – Edmund Lee Mar 20 '16 at 22:47
  • @Jarvey, you have multiple blantant error. This FAQ should also help. Read the **bold** sentences. [Top Mistakes by Developers new to Cordova/Phonegap](https://github.com/jessemonroy650/top-phonegap-mistakes/blob/master/new-to-Phonegap.md) Please respond in the comments \*to me (with my handle)\* or I cannot see your response. –  Mar 20 '16 at 23:54
  • 1
    @Jarvey, I watched the video. It is misleading. It is never shown to be working on a mobile device. In addition, both [Google and Apple frown on apps](https://github.com/jessemonroy650/top-phonegap-mistakes/blob/master/new-to-Phonegap.md#005a) that are website wrappers. The author has a misunderstanding of how Hybrid systems work. I would not follow any more videos by this author. I have also added it to my [list of BAD videos](https://github.com/jessemonroy650/top-phonegap-mistakes/blob/master/video-reviews/video-tutorials-bad.md). I left comments to let people know it is a bad video –  Mar 21 '16 at 00:16

1 Answers1

0

I watched the video as well. I believe you need to execute phonegap build ios (all lowercase ios) and then your build will render content, vs a blank screen.

Ryan Kulp
  • 1
  • 2