NimbleKit - fast iOS app development

ios 4.3 breaks app

Problem discussions

ios 4.3 breaks app

Postby alchemy » Mon Mar 28, 2011 2:40 pm

Hi,

Though i am getting no errors in x-code4 for the build, my app is broken in ios 4.3, both in the simulator and on the device.

4.2 runs the app fine...!

Its a lengthy de-bugging process to find the conflict, so i am hoping you all can throw some experiences my way, as to what could be breaking the app in 4.3

The app is rendering correctly and the NK functions seem to be working in most cases. But there are missing elements.
Ie slider created fro jquery ui, and my timers display created and rendered via jquery in my main js file.

Other jquery functions are working.

Other parts of the main js are working.. i am at a bit of a loss..?
User avatar
alchemy
 
Posts: 82
Joined: Fri Mar 04, 2011 10:50 pm

Re: ios 4.3 breaks app

Postby Big-O » Mon Mar 28, 2011 4:26 pm

When you say "breaks", can you describe what you mean exactly? Are you getting an error? Is there anything in the error log or console output?
-- Big-O
-- Nimblekit Guru, Web Developer, Hopeless Geek

I do freelance!
http://realisticweb.com
User avatar
Big-O
NimbleKit Guru
 
Posts: 1231
Joined: Thu Sep 24, 2009 4:02 am

Re: ios 4.3 breaks app

Postby alchemy » Mon Mar 28, 2011 5:14 pm

Hi Big-O,

No errors.. to be honest i would almost swear it is a z-index issue if i were building a website and testing in different browsers.
But i get no alert when clicking the start button, and i would normally, if the slider had not yet been moved, telling the user to set the time first.

because what it is exactly is missing elements.

compare the simulator in 4.2 build and 4.3 build...?


Image
User avatar
alchemy
 
Posts: 82
Joined: Fri Mar 04, 2011 10:50 pm

Re: ios 4.3 breaks app

Postby Big-O » Mon Mar 28, 2011 5:22 pm

Have you made sure that all of your javascript files are in the copy bundle resources folder and all your css files got copied right? I don't know of anything else that would cause a css element to not appear.
-- Big-O
-- Nimblekit Guru, Web Developer, Hopeless Geek

I do freelance!
http://realisticweb.com
User avatar
Big-O
NimbleKit Guru
 
Posts: 1231
Joined: Thu Sep 24, 2009 4:02 am

Re: ios 4.3 breaks app

Postby alchemy » Mon Mar 28, 2011 5:32 pm

Yes i have all js files in copy bundle resources and the sylesheet is certainly being read as there are elements there that would not be were it not.

I am leaning toward this function that creates the slider and it has a knock on effect to the missing timer.
But i cant get my head round why it is only failing in 4.3 build if it is this.

Code: Select all
<body onload="loaderFinished();">

<script>

// Ball slider function, sets the ball and needle position
   $(function() {
      $( "#ballSlider" ).slider({
         range: "max",
         min: 0,
         max: 24,
         value: 0,
            slide: function( event, userSlid ) {
               // set the status tab colour depending on slider position
                if(userSlid.value == 0){
               flipTab("red");
               }else{
               flipTab("green");
               }
         
               var userSelectedSliderValue = userSlid.value * 10 + 39;
               $("#needle").css("left",userSelectedSliderValue);
            
               seconds = userSlid.value * 10 * 60;
               userDefinedTime = seconds;
               var clockOutput = secondsToString(seconds);
                    setTheClock(clockOutput);
               setanewfinalalarmplayer();
            }
      });
      setTheClock("0:00:00");
   });
User avatar
alchemy
 
Posts: 82
Joined: Fri Mar 04, 2011 10:50 pm

Re: ios 4.3 breaks app

Postby alchemy » Mon Mar 28, 2011 11:17 pm

with some NKLog's inserted in the files in strategic places i am getting logs in the console from every file including the mian.html.

But i am not getting any thing logged from within the script tags in the body of the main.html.

This is where the main slider is configured, and this is obviously the root of the problem.

But why only in 4.3 and none of the other sims.?

main.html with logs commented:
Code: Select all
<html>
<head>
<meta name = "viewport" content = "initial-scale = 1.0, user-scalable = no" />
   
   <!-- Links to styles -->
   <link href="jquery-ui.css" type="text/css" rel="stylesheet"/>
   <link rel="stylesheet" type="text/css" media="screen" href="mainStyles.css"  />
   
   <!-- Links to javascript files -->
   <script type="text/javascript" src="NKit.js"></script>
    <script src="jquery.min.js"></script>
    <script src="jquery-ui.min.js"></script>
    <script src="jquery.ui.mouse.touch.js"></script>
   <script src="parkiTimer.js"></script>
   
   
   <script>
        NKLog("i am in the head");// returned finexxxxxxxxxx
   // Loading This Page Finished Function
   function loaderFinished(){
      NKStartPreloadingPage("settings.html"); // Preload settings.html
   }
       
   </script>
   
   
</head>       




<body onload="loaderFinished();">
   
<script type="text/javascript">
         NKLog("in the script tags of the ball slider function");// not returned xxxxxxxxxx
        // Ball slider function, sets the ball and needle position
        $(function() {
          NKLog("in the ball slider function");// not returned xxxxxxxxxx
          $( "#ballSlider" ).slider({
                                    range: "max",
                                    min: 0,
                                    max: 24,
                                    value: 0,
                                    NKLog("ball settins have been read");// not returned xxxxxxxxxx
                                    slide: function( event, userSlid ) {
                                    // set the status tab colour depending on slider position
                                    if(userSlid.value == 0){
                                    flipTab("red");
                                    }else{
                                    flipTab("green");
                                    }
                                    NKLog("when slider is moved i appear");// not returned xxxxxxxxxx
                                    var userSelectedSliderValue = userSlid.value * 10 + 39;
                                    $("#needle").css("left",userSelectedSliderValue);
                                   
                                    seconds = userSlid.value * 10 * 60;
                                    userDefinedTime = seconds;
                                    var clockOutput = secondsToString(seconds);
                                    setTheClock(clockOutput);
                                    setanewfinalalarmplayer();
                                    }
                                    });
          setTheClock("0:00:00");
          NKLog("clock should be set now");// not returned xxxxxxxxxx
          });
</script>



<!-- Absolutely positioned container divs -->
   <div id="studsMain"></div>
   <div id="meter"></div>
    <div id="needle"></div>
   <div id="time"></div>
   <div id="tabs"></div>
   <div id="slot"></div>
   <div id="startButton" class="rebutton"></div>
   <div id="resetButton" class="rebutton"></div>
   <div id="sliderGuard"></div>

<!-- html for main slider -->
   <div class="ball">
   <div id="ballSlider"></div>
   </div>

<!-- link to settings page -->
   <a href="#" onClick="NKMoveToPageAnimated('settings.html', 'FlipRight')">
   <div id="switchScreensHome"></div>
   </a>


<script>
// master start button
   $("#startButton").click(function() {
                            NKLog("start button clicked");
      masterstart();
   });

// master reset button
   $("#resetButton").click(function() {
      mastereset();
   });
   
   
// Aplication Quit Function
   function OnApplicationQuit() {
      // reset the icon badge to none
      var parkiBadge = new NKApplication();
      parkiBadge.setBadgeCount();
   
      //end all audio players
      endAudioPlayers();
   }


// Aplication Pause Function
   function OnApplicationPause() {
      // if timer is running set the icon badge to 1
      if(timerRunning){
      var parkiBadge = new NKApplication();
      parkiBadge.setBadgeCount(1);
   }
   else{
   var parkiBadge = new NKApplication();
      parkiBadge.setBadgeCount();
   }
   
   // get the time of app pause
   var now = new Date();
   PauseTimeStamp = Math.round(now.getTime() / 1000);
   var settings = new NKSettings();
   settings.setValueForKey(PauseTimeStamp, "pausedtime");
   }


// Aplication Resume Function
   function OnApplicationResume() {
      // get the time of app resume
      var now = new Date();
      var ResumeTimeStamp = Math.round(now.getTime() / 1000);
      var settings = new NKSettings();
      var timepaused = settings.getValueForKey("pausedtime");
      var appPausedTime =  ResumeTimeStamp - timepaused;
      appHasBeenResumed(appPausedTime);
   }
   
   
    $('#sliderGuard').click(function() {
                            $('#sliderGuard').append("<center>Press<br />Reset</center>");
                            setTimeout ( "$('#sliderGuard').html('')", 1000 );
                            });
    NKLog("got to the end of the main html");// returned fine xxxx
</script>



</body>
</html>
User avatar
alchemy
 
Posts: 82
Joined: Fri Mar 04, 2011 10:50 pm

Re: ios 4.3 breaks app

Postby Big-O » Mon Mar 28, 2011 11:20 pm

Try moving that javascript block from the body into the head so that it runs before the pre loading fires.
-- Big-O
-- Nimblekit Guru, Web Developer, Hopeless Geek

I do freelance!
http://realisticweb.com
User avatar
Big-O
NimbleKit Guru
 
Posts: 1231
Joined: Thu Sep 24, 2009 4:02 am

Re: ios 4.3 breaks app

Postby alchemy » Tue Mar 29, 2011 12:21 am

I have tried removing everything but the slider block of script and moved that to the head, so all that should be seen is the slider.

Left the nklog just under the first script tag and it returns nothing while above and below the script tags return fine.

I can only assume it reading the script and crashing that thread before it has a chance to log it, even though the log comes first.
User avatar
alchemy
 
Posts: 82
Joined: Fri Mar 04, 2011 10:50 pm

Re: ios 4.3 breaks app

Postby sunny » Tue Mar 29, 2011 2:29 pm

File name error:
Code: Select all
<script src="jquery-ui.min.js"></script>

must be
Code: Select all
<script src="jquery-ui-min.js"></script>

To test javascript code (which does not include NimbleKit functions, or comment them out) you can use regular desktop Safari.app, open Window->Activity and see all the error you have in your code, then fix and try again until your code runs perfectly fine.
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: ios 4.3 breaks app

Postby alchemy » Wed Mar 30, 2011 1:25 am

Yes, thanks for that Sunny.
I think i would have re-written the entire app before i found that one.
User avatar
alchemy
 
Posts: 82
Joined: Fri Mar 04, 2011 10:50 pm


Return to Troubleshooting

Who is online

Users browsing this forum: No registered users and 0 guests