native.newTextField results in black screen

I’m trying to get user input in an OS X app and was just going to use the example code from the Docs. However whenever I compile the app it just creates a black screen. There seems to be a textfield in the middle, but it does not seem to respond. Anyone else having this issue? 

[lua]

display.newRect(display.contentCenterX,display.contentCenterY,display.contentWidth,display.contentHeight)

local defaultField

local function textListener( event )

    if ( event.phase == “began” ) then

        – user begins editing defaultField

        print( event.text )

    elseif ( event.phase == “ended” or event.phase == “submitted” ) then

        – do something with defaultField text

        print( event.target.text )

    elseif ( event.phase == “editing” ) then

        print( event.newCharacters )

        print( event.oldText )

        print( event.startPosition )

        print( event.text )

    end

end

– Create text field

defaultField = native.newTextField( display.contentCenterX, display.contentCenterY, 180, 30 )

defaultField:addEventListener( “userInput”, textListener )

[/lua]

Your code works fine for me:

What versions of OS X and CoronaSDK are you using?

I’ve found out what the issue was. The app is set to default to fullscreen on start up. That hadn’t been causing an issue, but I’d recently upgraded to the latest daily build 2016.2824. Somewhere along the way something changed - it had been initialising the screen in fullscreen dimensions, now it initialises at a different resolution, then transitions into fullscreen resolution.

Because of that the white background was not appearing on the screen hence the confusion! 

Putting the above in a function and using the below code fixed the issue:

[lua]

Runtime:addEventListener(“resize”, function (event)

  if not start then

    return

  end

  timer.performWithDelay(500,start)

  start=nil

end)

if system.getInfo(“environment”)==“simulator” then

  start()

end

[/lua]

At some point I will need to do something prettier!

Here’s the build.settings file I am using

[lua]

settings = {

    window = {

        – Settings for the desktop window; applies to both OS X and Win32 desktop apps

        defaultMode = “fullscreen”,

        resizable = true,

        enableMinimizeButton = true,

    },

}

[/lua]

Also I am on OS X 10.11.3 

Your code works fine for me:

What versions of OS X and CoronaSDK are you using?

I’ve found out what the issue was. The app is set to default to fullscreen on start up. That hadn’t been causing an issue, but I’d recently upgraded to the latest daily build 2016.2824. Somewhere along the way something changed - it had been initialising the screen in fullscreen dimensions, now it initialises at a different resolution, then transitions into fullscreen resolution.

Because of that the white background was not appearing on the screen hence the confusion! 

Putting the above in a function and using the below code fixed the issue:

[lua]

Runtime:addEventListener(“resize”, function (event)

  if not start then

    return

  end

  timer.performWithDelay(500,start)

  start=nil

end)

if system.getInfo(“environment”)==“simulator” then

  start()

end

[/lua]

At some point I will need to do something prettier!

Here’s the build.settings file I am using

[lua]

settings = {

    window = {

        – Settings for the desktop window; applies to both OS X and Win32 desktop apps

        defaultMode = “fullscreen”,

        resizable = true,

        enableMinimizeButton = true,

    },

}

[/lua]

Also I am on OS X 10.11.3