Parse.com – Corona SDK integration tutorials updated!

hi, everyone. I have updated the Corona SDK – Parse.com codebase to account for Graphics 2.0 changes, fixing a bug, and using Develephant’s Parse_Mod module which makes Parse integration really easy. This repo includes the entire codebase, please fork it and have fun with it!

https://github.com/jlooper/DessertOMeter-GFX2

- Instead of hand-coding each Parse call, I’m using Develephant’s Parse_Mod library. Check it out on http://www.develephant.net. It’s so awesome that it won the Cat’s Pajamas Award!

- I needed to fix the layout of the screen to better account for different screen sizes. Also the colors were impacted by the changes made for Graphics 2.0 so there are a bunch of tweaks to make everything look nice again. Buttons as well are reskinned. One thing you need to do if you try to device test this codebase is to add the Default-568h.png file to your root to avoid letterboxing (this graphic functions as the tall device splash screen, it’s a little Apple kludge).

- There is a lot going on in this codebase so you can walk through the tutorials while referencing this new set of code. It allows you to register a user with a favorite dessert flavor, email the user a welcome message, counts how many people are associated with the flavor and displays that for a user, allows the user to take a picture and upload it to Parse.com, and sets the app to accept push notifications.

- There was a bug in the old code and the cloud code that caused an error to be thrown if no one happened to have selected the flavor of the day, so that’s corrected in the lua code; below I’ve pasted the cloud code that you need to edit (see the tutorial on Parse cloud code if you need pointers on how to set it up).

Here’s the cloud code:

// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
Parse.Cloud.define("getFeatured", function(request, response) {
//response.success("chocolate");
//this code assumes that we know the flavor of the day is chocolate. We count how many users //like chocolate, even if none do. We return either the string 'chocolate' if there are no //users with that favorite, or a table of users if there are.
var query = new Parse.Query(Parse.User);
query.equalTo("favorite", "chocolate");
query.find({
success: function(results) {
if (results.length == 0){
response.success("chocolate");
}
else{
response.success(results);
}
},
error: function(results,error) {
response.error(error);
}</code>
 
});
 
});
 
//mailgun
Parse.Cloud.define("sendEmail", function(request, response) {
var Mailgun = require('mailgun');
var email = request.params.email;
Mailgun.initialize('dessertometer.mailgun.org', 'your-mailgun-key-here');
Mailgun.sendEmail({
to: email,
from: "dessert-o-meter@ladeezfirstmedia.com",
subject: "Welcome",
text: "Welcome to the Dessert-O-Meter!"
}, {
success: function(httpResponse) {
console.log(httpResponse);
response.success("Email sent!");
},
error: function(httpResponse) {
console.error(httpResponse);
response.error("Uh oh, something went wrong");
}
});
});

Let me know if you have questions!

Like my tutorials? You’ll love my apps. Please download, rate and review!

12 Responses

  1. Very cool Jen. Thanks for the mod_parse shout out. :)

    Cheers.

  2. Really interesting Jen, It helps a lot! Thanks you

  3. Alright, you da (wo)man!

  4. Hi Jen – Would be interested in whether you looked at alternatives to Parse and whether Parse is more suited for Corona developers for some reason? I’m most concerned about (all go well) the risk of getting lots of downloads/usage on a freemium game and whether the ads would pay for the cost of parse when you exceed the free plan limits…

    Found a reasonable review of alternatives here in fact. http://stackoverflow.com/questions/19811434/are-there-alternatives-to-parse-com-for-ios

    • hi, I have used both Parse and Kii, with Parse far better than Kii. I think any of those alternatives are worth trying, for sure. I don’t think one is better than the other, the only thing that will probably impact your choice will be cost. This is why Chris is developing Chromium which is self-hosted and thus unlimited. It sounds like a great alternative if you don’t mind self-hosting (I prefer a managed solution). One thing to remember is I don’t tend to develop games that have a chance to go viral, lol, I develop business apps. :)

      So find something that works for you and let me know how you like it! I actually would like to look at Kinvey and may do that in the future.

      best,
      Jen

      • thanks Jen – mind if I ask

        * have you got a link to Chromium that you mention Chris is developing? (this isn’t the google Chromium product then?)

        * re business apps on Corona – don’t suppose you know of a good Corona 3rd party graph/chart library?

        Cheers

        • hi, sure thing. You can get access as a betatester for Coronium from Chris at develephant.net (I’m not sure how open he wants to make it right now so “tell him I sent you”) :)

          Charts and graphs….Looks like Graham at GlitchGames has created something a while ago that you can build on. Their libraries are fantastic, take a look: https://developer.coronalabs.com/code/charts

          best,
          Jen

        • hey Greg, this is what happens when I’m jet lagged and respond to emails. The name of Chris’s project is Coronium, not Chromium. Also, I did take a look at Kinvey briefly after our exchange of emails. I think that the thing that makes Parse work so well for us is that it has good documentation and a well-developed REST API module. That’s really what I’m looking for. Kinvey’s isn’t so great, as it turns out, based on my brief review of their docs. Parse has a lot of built-in sugar that we can easily leverage.

  5. Hi
    I am using this mailgun but i have some error during sending email. It says page not found.
    Please help me.

    • hi, can you give me some more information? What is telling you ‘page not found’? Where do you see the error? And what is generating it?

Leave a Reply