I confirm that a query will always return a table array of the results as we are doing so many of them.
hi,
thanks again.i use your code and it is my whole code now
local function cb( ok, res ,info) for key, value in pairs( res) do print( key,value ) end end parse.request( parse.Object.query, "countertest" ) :where( { yes = "kkk" } ) --The search key query :response(cb)
console return=results table: 072F8038
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-12 20:50:14 [1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> results: \> 1: \> createdAt: 2015-12-11T07:58:19.547Z \> objectId: s6Au2jeHmF \> updatedAt: 2015-12-11T07:58:19.547Z \> yes: kkk \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* results table: 072F8038
and I change code 3,info instead of res
local function cb( ok, res ,info) for key, value in pairs( info) do print( key,value ) end end parse.request( parse.Object.query, "countertest" ) :where( { yes = "kkk" } ) --The search key query :response(cb)
it can show the info table key and value,i really don’t understand why res can not get value
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-12 20:51:17 [1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> results: \> 1: \> createdAt: 2015-12-11T07:58:19.547Z \> objectId: s6Au2jeHmF \> updatedAt: 2015-12-11T07:58:19.547Z \> yes: kkk \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* isError false responseHeaders table: 072910B8 responseType text status 200 url https://api.parse.com/1/classes/countertest?where=%7b%22yes%22%3a%22kkk%22%7d bytesEstimated 130 bytesTransferred 130
Hi,
Well, you actually didn’t use my code, my example was like so:
local function callback( ok, res )
for _, result in ipairs( res ) do
print( result.objectId )
end
end
I am specifically using ipairs , not pairs. Notice the “_” meaning that is a “throwaway” value (an index), the result is a result object (keyed table) that you can use like any other, including result.objectId.
There is no “key” (only index), in a collection of result objects. So you must cycle through them. If you use pairs, it is not the same thing.
Any content with multiple results is going to be contained in a collection of some type, and this isn’t necessarily specific to Lua. But in this case it’s a Lua table array. Do you feel comfortable in knowing the difference between a table array and a keyed table? Because it’s a fundamental concept, for any Lua coding you are going to be doing. What are you going to do if you have multiple results? You must to have some way to contain them.
If you want one record, use .get methods with id, if you are performing a .query , you are commonly expecting multiple results, and possibly only 1 or no results. It’s up to you to adjust accordingly. This is a generally accepted practice and is directly related to the Parse API.
If you are absolutely positive that your query will result in one and only one record, then you can access it directly like so:
function (ok, res)
if ok then
res[1].objectId
end
end
I am not saying that I recommend that though. If you are looking for only one specific record, but don’t have an id, then try a Macro like findWhereEqual:
parse.macro.findWhereEqual( ‘countertest’, ‘yes’, ‘kkk’ )
:response(cb)
That should only return one result.
Cheers.
hi
i did try your code before,but it show nothing ,so i didn’t tell you,sorry, it my fault.
here is my code
parse.request( parse.Object.create, "countertest" ) :data({ yes = "kkk" } ) :response(function( ok, res ) if not ok then print('err', res) else print('create ok', res) end end) parse.macro.findWhereEqual( 'countertest', 'yes', 'kkk' ) :response(cb) local function cb( ok, res ) print("yes i am in begin of cb function") for \_, result in ipairs( res ) do print( result.objectId ) end print("yes i am in the end of cb function") end parse.request( parse.Object.query, "countertest" ) :where( { yes = "kkk" } ) --The search key query :response(cb)
it return
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-14 08:59:09 [1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> results: \> 1: \> createdAt: 2015-12-14T08:52:00.425Z \> objectId: 41jmOfO6IG \> updatedAt: 2015-12-14T08:52:00.425Z \> yes: kkk \> 2: \> createdAt: 2015-12-14T08:52:28.765Z \> objectId: RGwpfMevi8 \> updatedAt: 2015-12-14T08:52:28.765Z \> yes: kkk \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* yes i am in begin of cb function yes i am in the end of cb function \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-14 08:59:09 [2] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> createdAt: 2015-12-14T08:59:07.681Z \> objectId: c0L0uNHfcq \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* create ok table: 0767E1E0 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-14 08:59:09 [3] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> code: 102 \> error: Invalid key $eq for find \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
here is my parse screen picture
code line 13
it return as below,i did try before and I post it before,but someone say he can not understand it, so I edit and delete it.
\> code: 102 \> error: Invalid key $eq for find
and I try your code line 22,it return nothing
you can see line 19 and 25,this is nothing between them.
yes i am in begin of cb function
yes i am in the end of cb function
plus,if I change code to
function (ok, res) if ok then res[1].objectId end end
simulator will show error window,it can not even run code
@wgh92281, There is many bugs in your code, that its hard to understand what you are really trying to accomplish here. Sometime you do not declare the callback, other time you do not define a name for your function…
How much experience do you have in coding ? and with Lua ?
I believe the best way we can help you is if you paste the whole source code from beginning to end that your are executing. No more snippets please as it is too hard for us to help you. Put the whole things here so we can understand the whole execution.
thanks again,it is my fault,i didn’t make it clear.in previous post, my code is actually my whole code expect parse.config
I paste my whole code. all I want is find the objectId that I created in no matter what way
local parse = require('plugin.parse') parse.config:applicationId("K4wlYq18ueOcW2Fj8uJ1EvcF5TD74QPKZOgoai83") parse.config:restApiKey("EnWOVpfkESrv4daVA6uFpvztHN2A17yrP2e4eyqd") parse.config:debugEnabled( true ) parse.request( parse.Object.create, "countertest" ) :data({ yes = 'kkk' } ) :response() parse.macro.findWhereEqual( 'countertest', 'yes', 'kkk' ) :response(function( ok, res ) if not ok then print('find err', res) else print('find ok', res.objectId ) end end) local function cb( ok, res ) print("yes i am in begin of cb function") if ok then print("yes i am in midlle of cb function") for \_, result in ipairs( res ) do print( result.objectId ) end end print("yes i am in the end of cb function") end parse.request( parse.Object.query, 'countertest' ) :where( { yes = 'kkk' } ) --The search key query :response(cb)
it return in simulator console
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-14 22:11:34 [1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> createdAt: 2015-12-14T22:11:37.782Z \> objectId: 5FBdnB6KK7 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-14 22:11:34 [2] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> code: 102 \> error: Invalid key $eq for find \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* find ok nil \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-14 22:11:34 [3] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> results: \> 1: \> createdAt: 2015-12-14T08:52:00.425Z \> objectId: 41jmOfO6IG \> updatedAt: 2015-12-14T08:52:00.425Z \> yes: kkk \> 2: \> createdAt: 2015-12-14T08:52:28.765Z \> objectId: RGwpfMevi8 \> updatedAt: 2015-12-14T08:52:28.765Z \> yes: kkk \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* yes i am in begin of cb function yes i am in midlle of cb function yes i am in the end of cb function
code line 11 return
> code: 102
> error: Invalid key $eq for find
code line 29 return nothing
if you have time, feel free to paste the whole code to your pc to run the code.you will see what I see.
this is the code without line number
local parse = require('plugin.parse') parse.config:applicationId("K4wlYq18ueOcW2Fj8uJ1EvcF5TD74QPKZOgoai83") parse.config:restApiKey("EnWOVpfkESrv4daVA6uFpvztHN2A17yrP2e4eyqd") parse.config:debugEnabled( true ) parse.request( parse.Object.create, "countertest" ) :data({ yes = 'kkk' } ) :response() parse.macro.findWhereEqual( 'countertest', 'yes', 'kkk' ) :response(function( ok, res ) if not ok then print('find err', res) else print('find ok', res.objectId ) end end) local function cb( ok, res ) print("yes i am in begin of cb function") if ok then print("yes i am in midlle of cb function") for \_, result in ipairs( res ) do print( result.objectId ) end end print("yes i am in the end of cb function") end parse.request( parse.Object.query, 'countertest' ) :where( { yes = 'kkk' } ) --The search key query :response(cb)
The following code is going to show you several ways to make this work, but please remember the following :
-
Everything is asynchronous
-
If you create objects with always the same parameters and if you are doing a query with those parameters, then you will get all the objects that share the same values (This was one of your mistake before)
– ************************************************************************ – CREATING OUR OBJECT – ************************************************************************ local function createObject(value) local function objCreatedCallback( ok, res, info ) if ok == true then if res.code and res.error then print("something happen > ", res.code, res.error) else print(“this is the id of the " … value … " object you just created”, res.objectId ) end end end parse.request( parse.Object.create, “countertest” ) :data({ name = value } ) :response(objCreatedCallback) end print(“Creating our blue object…”) createObject(“blue”) print(“Creating our red object…”) createObject(“red”) – ************************************************************************ – QUERY ALL – ************************************************************************ print("Perform a queries to list all ‘countertest’ object class ") local function queryCallback( ok, res, info ) if ok == true then if res.code and res.error then print("something happen > ", res.code, res.error) else for _, result in ipairs( res ) do print( result.objectId ) end end end end parse.request( parse.Object.query, “countertest” ) :response(queryCallback) – ************************************************************************ – QUERY OBJECT TYPE OF COUNTERTEST – ************************************************************************ print("Perform a queries to find specific instances of an object, for example the blue one… ") local function queryCallback( ok, res, info ) if ok == true then if res.code and res.error then print("something happen > ", res.code, res.error) else for _, result in ipairs( res ) do print( result.objectId ) end end end end parse.request( parse.Object.query, “countertest” ) :where( { [“name”] = “blue” } ) :response(queryCallback)
thanks again, i am very appreciate your help.
step 1.
I copy all your code replace my main.lua and relaunch simulator
simulator console did show parse response,
but code as below don’t work, it didn’t print result.objectId,it print nothing
for \_, result in ipairs( res ) do print( result.objectId ) end
step 2.
1.I know asynchronous mean I must wait some time to get the result.
2.you say don’t always create same parameters ,so I only create parameters once and then query.
this is what I do
I change class name from countertest to countertest3 and replace “blue” to “ha” and relaunch again only once
it still print nothing
step 3.
I delete create function, only left query function as below is my whole code
local parse = require('plugin.parse') parse.config:applicationId("K4wlYq18ueOcW2Fj8uJ1EvcF5TD74QPKZOgoai83") parse.config:restApiKey("EnWOVpfkESrv4daVA6uFpvztHN2A17yrP2e4eyqd") parse.config:debugEnabled( true ) print("Perform a queries to list all 'countertest' object class ") local function queryCallback( ok, res, info ) if ok == true then if res.code and res.error then print("something happen \> ", res.code, res.error) else for \_, result in ipairs( res ) do print( result.objectId ) end end end end parse.request( parse.Object.query, "countertest3" ) :response(queryCallback)
simulator console still return same result that I have see many times as blow.
I can see parse response on simulator console ,it mean parse did response result
but code line 13 still dont’ work,it didn’t print anything
Perform a queries to list all 'countertest' object class \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\* Parse RESPONSE @ 12-15 06:10:45 [1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \> results: \> 1: \> createdAt: 2015-12-15T03:56:02.038Z \> name: ha \> objectId: p01QtAm3yU \> updatedAt: 2015-12-15T03:56:02.038Z \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Try replacing this with :
for key, value in ipairs( res.results ) do print( "MyObject Id", value.objectId ) end
it works ,thanks all you guys. i know i have a lot to learn,again ,thanks
@wgh92281, my last suggestion prove that if you had put a breakpoint from the beginning of your problem, you would have found the solution right away. Please next time, use a debugger, put a breakpoint and investigate return value. It help you and it help us.
Hi Corona Community!
Today I have a question, regarding checking already existing usernames via Parse.
On my login page, I am allowing my user to create an account(username + password). I am using Parse backend for this.
I need help writing code that will handle if the username they choose to use already exists on my parse user database!
My code so far is below of my account creation file.
ALL help is appreciated! Thanks!
- –remove status bar
- display.setStatusBar( display.HiddenStatusBar )
- –require modules
- local composer = require “composer”
- local scene = composer.newScene()
- local parse = require(‘plugin.parse’)
- parse.config:applicationId(“MY ID HERE”)
- parse.config:restApiKey(“MY REST API KEY HERE”)
- parse.config:debugEnabled( true )
- parse.showStatus = true
- local usernameInput
- local passwordInput
- local bg
- local createAccountBtn
- local createAccount
- local function onUsername( event )
- if ( “began” == event.phase ) then
- – This is the “keyboard appearing” event.
- – In some cases you may want to adjust the interface while the keyboard is open.
- elseif ( “submitted” == event.phase ) then
- – Automatically tab to password field if user clicks “Return” on virtual keyboard.
- native.setKeyboardFocus( passwordInput)
- end
- end
- local function onPassword( event )
- – Hide keyboard when the user clicks “Return” in this field
- if ( “submitted” == event.phase ) then
- native.setKeyboardFocus( nil )
- end
- end
- –create account
- local function createAccount(event)
- if (event.phase == “began”) then
- parse.request( parse.User.query )
- :where( { username = “”…usernameInput.text } )
- :response(cb)
- –check here if username already exists!
- –if it doesn’t exist, create account!
- –add account to parse database
- parse.request( parse.User.create )
- :data( { username = “”…usernameInput.text, password = “”…passwordInput.text} )
- :response(cb)
- end
- end
- –create scene
- function scene:create( event )
- local group = self.view
- bg = display.newRect(display.contentCenterX, display.contentCenterY, 800, 800)
- bg:setFillColor( 1, .6, 0 )
- – Create username text field
- usernameInput = native.newTextField( display.contentCenterX, 150, 260, 40 )
- usernameInput:setReturnKey( “next” )
- usernameInput.placeholder = " Username"
- group:insert(usernameInput)
- usernameInput:addEventListener( “userInput”, onUsername )
- – Create password text field
- passwordInput = native.newTextField( display.contentCenterX, display.contentCenterY, 260, 40 )
- passwordInput:setReturnKey( “go” )
- passwordInput.placeholder = " Password"
- group:insert(passwordInput)
- passwordInput:addEventListener( “userInput”, onPassword )
- – Create register account button
- createAccountBtn = display.newImage(“registerBtn.png”)
- createAccountBtn.x = display.contentCenterX; createAccountBtn.y = display.contentCenterY + 80
- createAccountBtn:scale(.15, .1 )
- end
- –enter scene
- function scene:show( event )
- local group = self.view
- local phase = event.phase
- if ( phase == “will” ) then
- elseif ( phase == “did” ) then
- createAccountBtn:addEventListener( “touch”, createAccount )
- end
- end
- –exit scene
- function scene:exitScene( event )
- local group = self.view
- end
- –destroy scene
- function scene:destroyScene( event )
- local group = self.view
- local phase = event.phase
- if ( phase == “will” ) then
- elseif ( phase == “did” ) then
- end
- end
- scene:addEventListener( “create”, scene)
- scene:addEventListener( “show”, scene)
- scene:addEventListener( “hide”, scene)
- scene:addEventListener( “destroy”, scene)
- return scene
Just wanted to say thanks for making this. Works perfectly so far for us!
@Mgoldberg62401, you also creates a specific thread for this (https://forums.coronalabs.com/topic/60626-check-if-parse-username-already-exists-help/). Please always ask a question in one place as it is hard after that for the community to know where to look. Please look at the specific thread you created for an answer…
PS: Thanks for the good word, but I am not an expert, the real expert is @develephant who created an amazing plugin.
@nmichaud: You probably know more about its real-world usage than I. :D Thanks again to helping out.
Cheers.
@nmichuad @develephant
Hi again! Your advise worked! I now have fully integrated a login and registration system in my app! Thanks for that!
HOWEVER,
I have 1 more question!
How can I allow files to be shared from device to device that are on my parse database?
I need to allow a user to record his/her voice on their app, and be able to send that to another user of the app via parse.
I know I will need to use the “upload” and “download” parse commands. If you could point me in the right direction or give me some sample code that would be awesome!
Thanks!
@Mgoldberg62401, there are many ways to do what you want. As it simplest form you could do something like that (again this is a suggestion without knowing the scope of what you want to do)
- Create a “voiceMsg” class in parse
- Create a “voiceMsg” object and set the parameters details… (destination user Id, play yes/no, etc)
- Use “parse.upload” to upload your file
- Use “parse.macro.linkFileToObject” to link it to your newly created “VoiceMsg” object
- notify your user with the “VoiceMsg” objectId or better simply notify your user that a msg is waiting for him
- your user do a query on the msg waiting for him
- download the file
- do some clean up on “VoiceMsg” object
Again, this is just a quick and dirty way of doing this.
I hope this help
Thanks for your quick reply!
I understand each step clearly, thanks to you! However, how do I query for the message or audio file through parse**?**
I don’t quite get how the other device that is retrieving the file will be able to query for the message with that specific identifier. How will the device know what the Object ID is or the unique file URL?
If you could please explain this more clearly, or even better provide a code example, that would be much appreciated!
Thanks!