Build for iPad seems to work but I get Black Screen

I have seen forum post where users will get a black screen after they test there app on the device or in the xcode simulator. This is happing to my game as well and I can seem to figure out what I am doing wrong.

I have the latest version of xcode 4.2 installed and I am on os x Lion.

CoronaSDK Version 2011.657 (2011.8.2)

build ID is bd0b62066125b318f89dd3e5a7d762e2

Here is the output in my console:
Copyright © 2009-2011 A n s c a , I n c .
Version: 2.0.0
Build: 2011.657
The file sandbox for this project is located at the following folder:
(/Users/mwallace/Library/Application Support/Corona Simulator/Flying-space-rocks-FD1EAA67CD272202E94A88E231CCC307)

2011-11-07 10:28:04.979 Corona Simulator[1820:2403] [type]= í&âìÚ,d
[0992268993f22c640101]
2011-11-07 10:28:04.980 Corona Simulator[1820:2403] [valueType]=12
2011-11-07 10:28:04.980 Corona Simulator[1820:2403] [value]=LHDU62BAGS
[4c484455363242414753]
2011-11-07 10:28:04.983 Corona Simulator[1820:2403] [type]= í&âìÚ,d
[0992268993f22c640101]
2011-11-07 10:28:04.983 Corona Simulator[1820:2403] [valueType]=12
2011-11-07 10:28:04.984 Corona Simulator[1820:2403] [value]=EZXMRB7TWB
[455a584d524237545742]
2011-11-07 10:28:04.986 Corona Simulator[1820:2403] [type]= í&âìÚ,d
[0992268993f22c640101]
2011-11-07 10:28:04.987 Corona Simulator[1820:2403] [valueType]=12
2011-11-07 10:28:04.987 Corona Simulator[1820:2403] [value]=EZXMRB7TWB
[455a584d524237545742]
Using Custom Build Id bd0b62066125b318f89dd3e5a7d762e2
Using additional build settings from: /Users/mwallace/Development/mobile/Flying-space-rocks/build.settings
2011-11-07 10:28:58.332 defaults[1864:f07]
There is no (MinimumOSVersion) default for the (/Users/mwallace/Desktop/Flying-space-rocks.app/Info) domain.
Defaults have not been changed.
2011-11-07 10:28:58.333 defaults[1864:f07]
There is no (MinimumOSVersion) default for the (/Users/mwallace/Desktop/Flying-space-rocks.app/Info) domain.
Defaults have not been changed.
2011-11-07 10:28:58.415 defaults[1868:f07]
There is no (ContentOrientation) default for the (/Users/mwallace/Desktop/Flying-space-rocks.app/Info) domain.
Defaults have not been changed.
2011-11-07 10:28:58.417 defaults[1868:f07]
There is no (ContentOrientation) default for the (/Users/mwallace/Desktop/Flying-space-rocks.app/Info) domain.
Defaults have not been changed.
2011-11-07 10:28:58.438 defaults[1869:f07]
There is no (UISupportedInterfaceOrientations) default for the (/Users/mwallace/Desktop/Flying-space-rocks.app/Info) domain.
Defaults have not been changed.
2011-11-07 10:28:58.439 defaults[1869:f07]
There is no (UISupportedInterfaceOrientations) default for the (/Users/mwallace/Desktop/Flying-space-rocks.app/Info) domain.
Defaults have not been changed.
Compressing/copying PNG /Users/mwallace/Development/mobile/Flying-space-rocks/background_nxtlevel.png to /Users/mwallace/Desktop/Flying-space-rocks.app/background_nxtlevel.png [import]uid: 7501 topic_id: 17424 reply_id: 317424[/import]

Maybe its a case of filenames you use?

Filenames on iOS devices are case-sensitive. If you use Background.jpg and the file in Windows is called background.jpg, the simulator still loads the file without problems.

On the device however, it won’t find the file.

[import]uid: 50459 topic_id: 17424 reply_id: 66090[/import]

rmbsoft - that doesn’t seem to be the issue. Still have the same problem [import]uid: 7501 topic_id: 17424 reply_id: 66091[/import]

What format are your images saved in? Are they 32bits per pixel or some other format?

Have you tried using Xcode to look at what messages are printed when you run the app on your iPad?

[import]uid: 67839 topic_id: 17424 reply_id: 66101[/import]

99% of the images are PNG. I think I have 1 jpg. I created most the graphics using photoshop or fireworks. Usually would export for web when creating the final image.

How would I check if the images are 32bit and or insure they are ? What’s the process ? [import]uid: 7501 topic_id: 17424 reply_id: 66105[/import]

Try hooking up and viewing the log in Xcode to see if you get anything printed there as well - can be very useful in debugging.

Peach :slight_smile: [import]uid: 52491 topic_id: 17424 reply_id: 66195[/import]

What’s the process of “hooking” up to xcode for debugging ? I’ve used it in the past for Objective-c projects but in this case after I build the project with corona I use the xcode organizer to add the app to my ipad and then run it from there.

Is there a different process for doing what you suggested Peach ? [import]uid: 7501 topic_id: 17424 reply_id: 66246[/import]

was able to look in the xcode organizer under the ipad device I clicked on “console” and did a search for the app domain in the console output and found the following.

/private/var/mobile/Applications/487E8C67-E80A-465F-B6B4-D538591C203E [69] (sandbox)
Nov 8 09:08:53 unknown UIKitApplication:com.sixftview.flyingspacerocks[0x3530][5261] : -----------------------------------------------
Nov 8 09:08:53 unknown UIKitApplication:com.sixftview.flyingspacerocks[0x3530][5261] : Lua Runtime Error: lua_pcall failed with status: 2, error message is: ?:0: attempt to index global ‘app’ (a nil value)
Nov 8 09:10:50 unknown com.apple.launchd[1] : (UIKitApplication:com.sixftview.flyingspacerocks[0x3530]) Exited: Killed: 9
Nov 8 09:10:50 unknown SpringBoard[67] : Application ‘Flying Space Rocks’ exited abnormally with signal 9: Killed: 9
Nov 8 09:10:58 unknown notification_proxy[5254] : Could not receive size of message: 0 Invalid argument
Nov 8 09:10:58 unknown notification_proxy[5254] : Could not receive message
Nov 8 09:11:01 unknown DTMobileIS[5255] : Exiting wait (count : 0; pid : 5255)
Nov 8 09:11:01 unknown DTMobileIS[5255] : [DTInstrumentServer wait] done!
Nov 8 09:12:37 unknown dataaccessd[83] : ce977b0|DA|Error|AccountID:

Also I checked all my PNG files and made sure I ran a batch process on all of them in Fireworks to ensure that they are all exported as PNG 32. Finally I checked all my require statements for case sensitive mistakes and all seems to be good. [import]uid: 7501 topic_id: 17424 reply_id: 66272[/import]

I have the following from the simulator console log statements.
November/8/11 3:22:13.826 PM com.apple.launchd.peruser.502: (com.apple.iPhoneSimulator:com.apple.UIKit.pasteboardd) Unknown value for key POSIXSpawnType: Interactive
November/8/11 3:22:15.100 PM com.apple.iPhoneSimulator:com.apple.locationd: Can’t open BayesianFilter model file
November/8/11 3:22:15.101 PM com.apple.iPhoneSimulator:com.apple.locationd: Can’t open BayesianFilter model file
November/8/11 3:22:15.101 PM com.apple.iPhoneSimulator:com.apple.locationd: Input posteriorThresholds has wrong size.
November/8/11 3:22:15.119 PM com.apple.iPhoneSimulator:com.apple.locationd: NOTICE,Location icon should now not be visible
November/8/11 3:22:15.795 PM installd: ac0292c0 load_application_type: Could not extract identifier for /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk//Applications/Photo Booth.app
any of that point to the problem? [import]uid: 7501 topic_id: 17424 reply_id: 66331[/import]

You need to post code or look at your code. The app is trying to locate resources and can’t find them.

even requires are case sensitive, file names are case sensitive.

“Runtime Error: lua_pcall failed with status: 2, error message is: ?:0: attempt to index global ‘app’ (a nil value)”

this one says you are attempting to index global “app” but it is nil that means is not being allocated properly.

what is app assigned?

c. [import]uid: 24 topic_id: 17424 reply_id: 66332[/import]

I wonder if it has to do with Fonts? The variable “app” is in my app_data.lua file. I store sorts of data that I use in the app. I also reference font names there as well. Here is the code.
AppData = {}

function AppData:new()
require “json”
local app = {}
local LevelData = require(“com.sixftview.model.level_data”)
local level_data = LevelData:new()

local levels = level_data:getLevels()
local level_info

app.font_Teknobe = “Teknobe”
app.font_TektonPro = “Tekton Pro”
app.font_SynchroLET = “Synchro LET”
–print(level_data:getLevels())
–global settings
centerX = display.contentWidth * 0.5
centerY = display.contentHeight * 0.5

totalWidth = display.contentWidth
totalHeight = display.contentHeight

halfWidth = display.contentWidth * 0.5
halfHeight = display.contentHeight * 0.5

local difficulty_easy = 1
local difficulty_medium = 2
local difficulty_hard = 3

local shield_count = 3

function app:getShieldCount()
return shield_count
end

function app:setShieldCount(value)
shield_count = shield_count + value
end

app.large_rock_points = 100
app.medium_rock_points = 200
app.small_rock_points = 300

app.enemy1_points = 1000
app.enemy2_points = 1500
app.enemy3_points = 2000
app.enemy4_points = 2500

app.goto_menu = false

app.level_total = 20

local level = 0
app.difficulty = difficulty_easy
app.life_count = 3
app.next_bonus = 5000
score = 0

local jsonFile = function( filename, base )

– set default base dir if none specified
if not base then base = system.ResourceDirectory; end

– create a file path for corona i/o
local path = system.pathForFile( filename, base )

– will hold contents of file
local contents

– io.open opens a file at path. returns nil if no file found
local file = io.open( path, “r” )
if file then
– read all contents of file into a string
contents = file:read( “*a” )
io.close( file ) – close the file after using it
end

return contents
end

level_info = json.decode(jsonFile(“level_info.json”))

function app:getEnemyData(value)
local key = tostring(value)
return level_info[“levels”][key][“enemies”]
end

function app:getRockData(value)
local key = tostring(value)
return level_info[“levels”][key][“rocks”]
end

function app:setCurrentLevel(value)
level = value
end

function app:getCurrentLevel()
return level
end

function app:getLevelData(num)
return levels[num]
end

function app:setLevelData(level)
level_data:setLevel(level)
end

function app:saveLevelData(data)
level_data:saveData(data)
end

function app:getAllLevelData()
return levels
end

return app
end

return AppData [import]uid: 7501 topic_id: 17424 reply_id: 66334[/import]

well why don’t you debug where the app gets newed?

and see what errors you get?

are the fonts installed on the device as well?

c
[import]uid: 24 topic_id: 17424 reply_id: 66335[/import]

OK … hell yeah I got it working on the device and in the simulator. Carlos, you where correct in pointing out the “app” nil value. once I traced down that dude it worked.

Debugging on the device and simulator was really new to me so now I have a pretty good handle on how to track down issues. Thanks to everyone for your help.
Best advice I can give from this experience is to launch the app on the device and look at the console in the xcode organizer.

[import]uid: 7501 topic_id: 17424 reply_id: 66345[/import]