[Resolved] Rate System, someone?

I have put a rate system in my code but for some reason didn’t work… I get the an error… someone can help me or post a rate system?

I will post my code that I have copy from another template: [import]uid: 23063 topic_id: 15658 reply_id: 315658[/import]

[code]

local itunesID = xxxxxx – I have put my itunesID here
– ask to rate the game if it’s the 4th time opening the app
local ratingData = loadValue( “rating.data” )

if ratingData == “0” then
–> file didn’t exist yet, first time opening
saveValue( “rating.data”, “1” )

elseif ratingData == “1” then
–> 2nd time opening
saveValue( “rating.data”, “2” )

elseif ratingData == “2” then
–> 3rd time opening
saveValue( “rating.data”, “3” )

elseif ratingData == “3” then
–> 4th time opening; show the popup asking to rate, dismiss, or don’t show again

local onRatingComplete = function( event )
if “clicked” == event.action then
local i = event.index
if 3 == i then
– Do nothing from user’s perspective, make sure it doesn’t show again
saveValue( “rating.data”, “10” )

elseif 2 == i then
– Do nothing; dialog will simply dismiss
saveValue( “rating.data”, “0” ) – reset back to 0

elseif 1 == i then
– First, make sure dialog won’t show anymore and then open app store link
saveValue( “rating.data”, “10” )
local itmsURL = “itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsuserReviews?type=Purple+Software&id=” … itunesID
system.openURL( itmsURL )
end
end
end

– Show alert with five buttons
local ratingAlert = native.showAlert( “Will you rate this wonderfull game?”, “”,
{ “Rate This Game”, “Remind Me Later”, “No, Thanks” }, onRatingComplete )

end
[/code] [import]uid: 23063 topic_id: 15658 reply_id: 57784[/import]

more specific
I get this error when I try to rating ( when is opening the app store )

“Could not connect to itunes store” [import]uid: 23063 topic_id: 15658 reply_id: 57790[/import]

Have a look at the class I had provided long ago here. It has been derived from and there are quite a few versions.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15658 reply_id: 57811[/import]

@Dhennrich

Are you sure your phone is connected to the internet? And that the app id you are using is live on the app store at present? [import]uid: 84637 topic_id: 15658 reply_id: 57854[/import]

Having the same problem. Code is exactly the same. Test on my Ipad and I know I have internet connection. Anyone find out why it does this.

Thanks [import]uid: 34105 topic_id: 15658 reply_id: 60601[/import]

To all who say they can’t get it working … Is your app live on the app store at present ? If not it will not work. You can’t rate an app that isn’t on the store.

Put in a app id of an app that is live on the store and you will see it works.

Here is an example of how to go to the ratings page of an app :

[code]
local function goToAppRating(appID)
local url = “itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa” … “/wa/viewContentsUserReviews?” … “type=Purple+Software&id=” … appID
system.openURL(url)
end

–Go to the app rating page (The app id in this example is from one of my own apps (I’m Sleepy) which is live on the app store.
goToAppRating(“444299768”)

[/code] [import]uid: 84637 topic_id: 15658 reply_id: 60724[/import]

Take a look at my Tilt Monster source code here:
http://developer.anscamobile.com/code/tilt-monster

There’s a rating system in-place that worked very well when the app was live. [import]uid: 52430 topic_id: 15658 reply_id: 60730[/import]

For some reason I cant get this to work. The store opens blank and it gives me a popup that cannot open Itunes store. I have internet and if I back out and go to my Itunes store everything works. Am I doing something wrong.

Thanks

[lua] – Setup “Rate Game Button” Button
local touchRateGameBtn = function( event )
if event.phase == “release” and rateGameBtn.isActive == true then

rateGameBtn.isActive = false

– Play Sound
local soundsOn = gameSettings[“soundsOn”]

if soundsOn == true then
local freeChan = audio.findFreeChannel()
audio.play( tapSound, { channel=freeChan } )

local freeChan2 = audio.findFreeChannel()
audio.play( runningSound, { loops=-1, channel=freeChan2 } )
end

local itmsURL = “itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsuserReviews?type=Purple+Software&id=467931579”
system.openURL( itmsURL )
end
end

if not rateGameBtn then
rateGameBtn = ui.newButton{
defaultSrc = “rategame.png”,
defaultX = 155,
defaultY = 59,
overSrc = “rategame-over.png”,
overX = 155,
overY = 59,
onEvent = touchRateGameBtn,
id = “rateGameBtn”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}

rateGameBtn.xOrigin = 330; rateGameBtn.yOrigin = 600
rateGameBtn.isVisible = false

gameGroup:insert( rateGameBtn )
end

[lua] [import]uid: 34105 topic_id: 15658 reply_id: 93762[/import]

Just to be clear the url you are directing to is an existing app, yes? [import]uid: 52491 topic_id: 15658 reply_id: 94044[/import]

Yes Peach. it is a existing app in the app store. [import]uid: 34105 topic_id: 15658 reply_id: 94104[/import]

Our of interest could you please put this code into your app:

[lua]local function doRating(event)
local url = “itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa”
url = url … “/wa/viewContentsUserReviews?”
url = url … “type=Purple+Software&id=”
url = url … “423086057”
system.openURL(url)
end
doRating()[/lua]

On your main page is fine - anywhere, really.

Then let me know if that loads OK or if it falls over with the same issue?

Peach :slight_smile:

PS - That’s a different app it’s linking too obviously, just hoping to isolate this further. [import]uid: 52491 topic_id: 15658 reply_id: 94216[/import]

Got the same thing. I have changed the code to look like this and it worked.

Thanks for all your help

[lua]local itmsURL = “https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/addUserReview?id=467931579&type=Purple+Software” --… itunesID
system.openURL( itmsURL )

[lua] [import]uid: 34105 topic_id: 15658 reply_id: 94481[/import]

How strange, I built an app only a week or so ago with that code.

In any case am happy to hear you have it working now, thanks for updating with your solution :slight_smile: [import]uid: 52491 topic_id: 15658 reply_id: 94681[/import]