私はコロナが初めてで、タブシーン内に gps を作成しようとしています。位置データの文字列が配置されるローカル変数 loc を作成しました
local loc = "Loading" -- as initial value
then a location handler put a new value to it
local function locationHandler( event )
...
loc = "the gps location"
end
function scene:createScene( event )
local group = self.view
-- create a white background to fill screen
local bg = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
bg:setFillColor( 255 ) -- white
local title = display.newRetinaText(loc, 0, 0, native.systemFont, 20 )
-- this is where the loc is placed in the title
title:setTextColor( 0 ) -- black
title:setReferencePoint( display.CenterReferencePoint )
title.x = display.contentWidth * 0.5
title.y = 170
end
問題は、シミュレーターで動作するデバイスで実行すると、loc にまだ「読み込み中」が含まれていることです。私がチェックしたところ、gpsは正常に動作し、loc変数に入れる必要があるテキストは、logcatを使用してチェックして、内部ハンドラーに入れる準備ができています。
私は何を間違っていますか?
ありがとう