Text does not appear on adhoc test, but it's fine on simulator

Hey guys, look at this chunk of code and see if you spot any problem. I couldnt. The text shows perfectly on simulator but on the iphone test it doesnt :frowning:  FYI the text I am talking about is “4 characters or more”.

local alertMSGchar = native.newTextBox( centerX , centerY + 25, 250, 36) alertMSGchar.font = native.newFont( "Gotham", 15 ) alertMSGchar.align = "center" alertMSGchar.text = "4 or more characters" alertMSGchar.hasBackground = false alertMSGchar:setTextColor(0, 0, 0, 0) local function onNickEditing(event) if event.phase == "began" then if (string.len(event.target.text) \< 4) then alertMSGchar:setTextColor(1, 0, 0, 1) end if (string.len(event.target.text) \>= 4) then alertMSGchar:setTextColor(0, 1, 0, 1) end elseif event.phase == "editing" then if (string.len(event.target.text) \> 8) then event.target.text = event.target.text:sub(1, 8) end if (string.len(event.target.text) \< 4) then alertMSGchar:setTextColor(1, 0, 0, 1) end if (string.len(event.target.text) \>= 4) then alertMSGchar:setTextColor(0, 1, 0, 1) end elseif event.phase == "ended" then if (string.len(event.target.text) \< 4) then event.target.text = "" end end end local function clearKeyboard() native.setKeyboardFocus(nil) alertMSGchar:setTextColor( 0, 0, 0, 0 ) end display.currentStage:addEventListener( "tap", clearKeyboard )

I see you’re using a custom font. Did you carefully follow this guide?

https://docs.coronalabs.com/guide/system/customFont/index.html

Brent

Hello Brent, thank you for your help once again. I added this line of code but still it doesn’t appear on the device.

local systemFonts = native.getFontNames()

Please follow the entire guide, and every step. Did you put the font file in the root directory of the project?

yes, I can assure I did follow every step. twice actually, I’ll try with a native corona font and see if it works

fixed :smiley: TY for the help

 inputText = native.newFont( "Gotham", 20 ) alertMSGchar = display.newText( "4 or more characters", centerX, centerY + 25, inputText, 20) alertMSGchar.align = "center" alertMSGchar.hasBackground = false alertMSGchar:setTextColor(0, 0, 0, 0) local function onNickEditing(event) if event.phase == "began" then if (string.len(event.target.text) \< 4) then alertMSGchar:setTextColor(1, 0, 0, 1) end if (string.len(event.target.text) \>= 4) then alertMSGchar:setTextColor(0, 1, 0, 1) end elseif event.phase == "editing" then if (string.len(event.target.text) \> 8) then event.target.text = event.target.text:sub(1, 8) end if (string.len(event.target.text) \< 4) then alertMSGchar:setTextColor(1, 0, 0, 1) end if (string.len(event.target.text) \>= 4) then alertMSGchar:setTextColor(0, 1, 0, 1) end elseif event.phase == "ended" then if (string.len(event.target.text) \< 4) then event.target.text = "" end end end local function clearKeyboard() native.setKeyboardFocus(nil) alertMSGchar:setTextColor( 0, 0, 0, 0 ) end

I see you’re using a custom font. Did you carefully follow this guide?

https://docs.coronalabs.com/guide/system/customFont/index.html

Brent

Hello Brent, thank you for your help once again. I added this line of code but still it doesn’t appear on the device.

local systemFonts = native.getFontNames()

Please follow the entire guide, and every step. Did you put the font file in the root directory of the project?

yes, I can assure I did follow every step. twice actually, I’ll try with a native corona font and see if it works

fixed :smiley: TY for the help

 inputText = native.newFont( "Gotham", 20 ) alertMSGchar = display.newText( "4 or more characters", centerX, centerY + 25, inputText, 20) alertMSGchar.align = "center" alertMSGchar.hasBackground = false alertMSGchar:setTextColor(0, 0, 0, 0) local function onNickEditing(event) if event.phase == "began" then if (string.len(event.target.text) \< 4) then alertMSGchar:setTextColor(1, 0, 0, 1) end if (string.len(event.target.text) \>= 4) then alertMSGchar:setTextColor(0, 1, 0, 1) end elseif event.phase == "editing" then if (string.len(event.target.text) \> 8) then event.target.text = event.target.text:sub(1, 8) end if (string.len(event.target.text) \< 4) then alertMSGchar:setTextColor(1, 0, 0, 1) end if (string.len(event.target.text) \>= 4) then alertMSGchar:setTextColor(0, 1, 0, 1) end elseif event.phase == "ended" then if (string.len(event.target.text) \< 4) then event.target.text = "" end end end local function clearKeyboard() native.setKeyboardFocus(nil) alertMSGchar:setTextColor( 0, 0, 0, 0 ) end