[SOLVED]Anyone implemented Corona Cloud successfully?

Hi,

I simply put the codes below in main.lua, but it wont work, the print never runs. i have replaced CC_Access_Key and CC_Secret_Key with mine keys, and put cloud.lua in the project root folder. anyone can run this successfully? 

local json = require ( “json” ) 

local cloud = require (“cloud”)

local function authListener( event )     

    print( ‘test’ )

end

cloud.init( ‘CC_Access_Key’, ‘CC_Secret_Key’, authListener)  

The init call will not call the auth listener.

The login and register calls that you do next will.

The init basically sets you up for the upcoming auth calls.

Ok seems their instruction is incorrect…

https://github.com/coronalabs/framework-cloud

But if i change

cloud.init( ‘CC_Access_Key’, ‘CC_Secret_Key’, authListener)  

to

cloud.init( ‘CC_Access_Key’, ‘CC_Secret_Key’)

there will have a error:

“Corona Cloud: You must provide a listener to the cloud.init call.” 

True…

You do need to define the listener…

[lua]

local function authListener(event)

    if event.type == “loggedIn” then

          – something here

    end

end

cloud.init( ‘CC_Access_Key’, ‘CC_Secret_Key’, authListener)

cloud.login({type = “user”, email = “someone@somewhere.com”, password = “password”})

[/lua]

the login command will call the listener.

Aha, i think i got it, Thanks a lot! :wink:

The init call will not call the auth listener.

The login and register calls that you do next will.

The init basically sets you up for the upcoming auth calls.

Ok seems their instruction is incorrect…

https://github.com/coronalabs/framework-cloud

But if i change

cloud.init( ‘CC_Access_Key’, ‘CC_Secret_Key’, authListener)  

to

cloud.init( ‘CC_Access_Key’, ‘CC_Secret_Key’)

there will have a error:

“Corona Cloud: You must provide a listener to the cloud.init call.” 

True…

You do need to define the listener…

[lua]

local function authListener(event)

    if event.type == “loggedIn” then

          – something here

    end

end

cloud.init( ‘CC_Access_Key’, ‘CC_Secret_Key’, authListener)

cloud.login({type = “user”, email = “someone@somewhere.com”, password = “password”})

[/lua]

the login command will call the listener.

Aha, i think i got it, Thanks a lot! :wink: