This was basically lifted from another example in the contributed code:
local function testNetworkConnection()
local netConn = require('socket').connect('www.apple.com', 80)
if netConn == nil then
return false
end
netConn:close()
return true
end
local function rateMe(event)
local DEVICE = system.getInfo ( "environment" )
ReviewURL = "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=434030469"
if DEVICE == "simulator" then
print ( "Cannot spawn this URL in the simulator" )
else
if testNetworkConnection() then
system.openURL ( ReviewURL )
hasRated = 1
saveSettings()
end
end
end
That function is the onRelease for a ui.newButton() that the user taps.
if hasRated == 0 then
rateButton = ui.newButton{defaultSrc="rate.png", defaultX = 191, defaultY = 42, onRelease=rateMe, x=display.contentWidth/2, y=205}
menuGroup:insert(rateButton)
end
This is code from my soon to be updated to version 1.1 and isn’t live in the app store yet, but there isn’t anything here Apple should reject for. YMMV. [import]uid: 19626 topic_id: 11260 reply_id: 40847[/import]