event.isError

类型 布尔值
事件 mapAddress
版本 版本 2024.3703
关键字 mapAddress , isError

概述

指示逆地理编码服务器返回的错误而不是位置。

通常情况下,它是 false,但在出错的情况下,它将是 true(其他事件属性为空)。 event.errorMessage 将包含描述错误的字符串。

示例

-- Create a native MapView (requires Xcode iOS Simulator build or device build)
-- You can create multiple maps, if you like...
local myMap = native.newMapView( 20, 20, 300, 220 )
myMap.mapType = "standard" -- other mapType options are "satellite" or "hybrid"
 
-- The MapView is just another Corona display object, and can be moved or rotated, etc.
myMap.x = display.contentWidth / 2
myMap.y = 120
 
-- Initialize map to a real location, since default location (0,0) is not very interesting
myMap:setCenter( 37.331692, -122.030456 )
 
local function mapAddressHandler( event )
    -- handle mapAddress event here
    if event.isError then
        print( "mapView Error: " .. event.errorMessage )
    else
        print( "The specified location is in: " .. event.city .. ", " .. event.country )
    end
end
 
myMap:nearestAddress( 38.898748, -77.037684, mapAddressHandler )