[Resolved] Application works on simulator - but hangs on iphone

I thought I had the hang of storyboards.

My sequence is…

Main.lua -> splash.lua -> showRA.lua

In showRA.lua I have a couple of buttons at the top. One button has a “+” in it and when pushed goes to another scene (addRA.lua) which gets a couple of data items of the screen, checks and retrieves some data from a SQLserver database via JSON, decodes the data and puts it into a internal database. The user can add more or hit the back button which goes to showRA.lua.

ShowRA.lua when invoked, pulls all the data from the database into a small table. It creates a tableview and puts the data from the table into it.

There is an onRowTouch event that is entered

local function onRowTouch( event )  
 local row = event.row  
 local background = event.background  
  
 if event.phase == "press" then  
 background:setFillColor( 0, 110, 233, 255 )  
 print( "Pressed row: " .. row.index )  
 RAdetailoptions.params.id=ID[row.index - 1]  
-- storyboard.gotoScene( "RAdetail" , RAdetailoptions)  
 storyboard.gotoScene( "RAdetail", RAdetailOptions)  
  
 end  
end  
  
The RadetailOptions look like...  
  
local RAdetailoptions =  
{  
 effect="slideLeft",  
 params =  
 {  
 id=0  
 }  
}  
  
(I have tried without the effect - didn't make any difference!)  
  

on the simulator it opens the scene RAdetail.LUA

On the Iphone, the row gets turned blue (you can just see this on the simulator) and then the application appears to hang. no other events appear to be active and the RAdetail.lua scene does not come up on the screen.

RADetail is really just a stub and I am unable to ascertain if it has even been entered (Is there anyway on a device to see the print statement output?

I will post the RAdetail code - bit as I said, I am not sure if it has been entered.

[code]


– scenetemplate.lua


local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local widget = require (“widget”)
local id
local ShowRAoptions =
{
effect=“slideRight”,
params=
{
}
}


– NOTE:

– Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.



– BEGINNING OF YOUR IMPLEMENTATION

– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view


– CREATE display objects and add them to ‘group’ here.
– Example use-case: Restore ‘group’ from previously saved state.


local w = display.contentWidth
local h = display.contentHeight
display.setDefault(“background”,255,255,255)
– Set background to white

local toolbarGradient = graphics.newGradient( {168,181,198,255},{139,157,180,255},“down”)

local titleBar = widget.newTabBar{
gradient = toolbarGradient,
bottomfill={117,139,168,255},
height=25}

titleBar.y = (display.screenOriginY + titleBar.contentHeight * 0.5) + 20

– create embossed text to go on toolbar
local titleText = display.newEmbossedText( “Rental Agreement Details”, 0, 0, native.systemFontBold, 14 )
titleText:setReferencePoint( display.CenterReferencePoint )
titleText:setTextColor( 255 )
titleText.x = 160
titleText.y = titleBar.y

bakbutton = widget.newButton{
id = “addrabakbtn2”,
left=15,
top=50,
width = 45, height = 15,
font = “HelveticaNeue-Bold”,
yOffset=-8,
xOffset=1,
fontSize = 16,
defaultColor={168,181,198,255},
label=“Back”,
onEvent = onBackButtonEvent}
group:insert (titleBar)
group:insert(titleText)
group:insert(bakbutton)
end
onBackButtonEvent = function ( event )
local btn = event.target

if event.phase == “release” then

storyboard.gotoScene( “showra” , ShowRAoptions )
end
end

– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
storyboard.removeScene(“showra”)
print( “1: enterScene event - RADetail” )
–id=event.params.id
–print ("Processing RA with ID = " … id)

local group = self.view


– INSERT code here (e.g. start timers, load audio, start listeners, etc.)


end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view


– INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)


end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
local group = self.view


– INSERT code here (e.g. remove listeners, widgets, save state, etc.)


end

– END OF YOUR IMPLEMENTATION

– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )


return scene
[/code] [import]uid: 178113 topic_id: 33822 reply_id: 333822[/import]

If you are using IOS, then the best thing is to plug your device into your Mac’s USB port and use XCode’s Organizer. You will see your device on the left and there is a “Console” entry that will show the console log. That is where your prints go to with a caveat. On iOS 6, Apple changed the rules on the console log and public build 840 will not show in the console log from iOS 6 devices. However if you’re running public build 971, then you should be fine.

If you are using Android, you need to install the “Android Debug Bridge” tools or what is known as “adb”. Once you have adb installed, you can from the terminal (on a mac) or from Windows “cmd” command, run the command “adb logcat” and you sill see all of the devices console log. I think the adb tools also includes a program called “ddms”. I use it for screen shots, but I think it shows the console log as well. Your android device also has to be plugged into your computer via USB.

Now, your likely problem (like 95% of the time), if it works in the simulator but not the device, then you likely trying to access a file where the case of the letters in the file name doesn’t match what is on the computer. For instance in the simulator “RADetail” and “RAdetail” are going to be treated the same, and on device they are different. I also noticed you have a capital .LUA listed. The device may be looking for a lower case .lua.
[import]uid: 199310 topic_id: 33822 reply_id: 134442[/import]

Thanks for both of those suggestions Rob - will investigate and let you know!
Stan [import]uid: 178113 topic_id: 33822 reply_id: 134449[/import]

Thanks Rob - Case incorrect on one of the names of the lua modules.

Stan [import]uid: 178113 topic_id: 33822 reply_id: 134450[/import]

If you are using IOS, then the best thing is to plug your device into your Mac’s USB port and use XCode’s Organizer. You will see your device on the left and there is a “Console” entry that will show the console log. That is where your prints go to with a caveat. On iOS 6, Apple changed the rules on the console log and public build 840 will not show in the console log from iOS 6 devices. However if you’re running public build 971, then you should be fine.

If you are using Android, you need to install the “Android Debug Bridge” tools or what is known as “adb”. Once you have adb installed, you can from the terminal (on a mac) or from Windows “cmd” command, run the command “adb logcat” and you sill see all of the devices console log. I think the adb tools also includes a program called “ddms”. I use it for screen shots, but I think it shows the console log as well. Your android device also has to be plugged into your computer via USB.

Now, your likely problem (like 95% of the time), if it works in the simulator but not the device, then you likely trying to access a file where the case of the letters in the file name doesn’t match what is on the computer. For instance in the simulator “RADetail” and “RAdetail” are going to be treated the same, and on device they are different. I also noticed you have a capital .LUA listed. The device may be looking for a lower case .lua.
[import]uid: 199310 topic_id: 33822 reply_id: 134442[/import]

Thanks for both of those suggestions Rob - will investigate and let you know!
Stan [import]uid: 178113 topic_id: 33822 reply_id: 134449[/import]

Thanks Rob - Case incorrect on one of the names of the lua modules.

Stan [import]uid: 178113 topic_id: 33822 reply_id: 134450[/import]