CloudKit to send push notifications via cron jobs?

I am creating a college menu application in which I need to send push notifications based on daily menus. Initially, I planned to store user data in a database through Heroku and use cron jobs to compare data in the database with daily menus and send corresponding notifications to users.

After the Cloudkit news, however, I thought I could use this instead of managing the server-related part of my code. However, after more careful study, it seems that Cloudkit is currently able to store data, but does not allow us to write server code.

I am wondering if I interpreted this restriction correctly, or, if you can, in fact, plan a CloudKit database for daily comparison of my data with the online menu and send the corresponding push notifications.

+4
source share
2 answers

It seems unbelievable that you will not use or consider Parse.com for something like this ...

(If not Parse, some other bAAs with a similar feature set.)

NOTE. - Now Parse is on back4app.com.

1) Parse is the easiest way to do using the iOS application

2) the whole idea of ​​Parse is that you have the cloud code, and it's incredibly simple,

https://parse.com/docs/cloud_code_guide

, "cron", . Parse!

, - " " iOS Parse.

,

-(void)tableView:(UITableView *)tableView
        commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
        forRowAtIndexPath:(NSIndexPath *)indexPath
    {
    int thisRow = indexPath.row;
    PFUser *delFriend = [self.theFriends objectAtIndex:thisRow];

    NSLog(@"you wish to delete .. %@", [delFriend fullName] );

    // note, this cloud call is happily is set and forget
    // there no return either way. life like that sometimes

    [PFCloud callFunctionInBackground:@"clientRequestFriendRemove"
            withParameters:@{
                            @"removeThisFriendId":delFriend.objectId
                            }
            block:^(NSString *serverResult, NSError *error)
            {
            if (!error)
                {
                NSLog(@"ok, Return (string) %@", serverResult);
                }
            }];

    [self back];    // that simple
    }

, "clientRequestFriendRemove". , , Parse,

Parse.Cloud.define("clientRequestHandleInvite", function(request, response)
{
// called from the client, to accept an invite from invitorPerson

var thisUserObj = request.user;
var invitorPersonId = request.params.invitorPersonId;
var theMode = request.params.theMode;

// theMode is likely "accept" or "ignore"

console.log( "clientRequestAcceptInvite called....  invitorPersonId " + invitorPersonId + " By user: " + thisUserObj.id );
console.log( "clientRequestAcceptInvite called....  theMode is " + theMode );

if ( invitorPersonId == undefined || invitorPersonId == "" )
  {
  response.error("Problem in clientRequestAcceptInvite, 'invitorPersonId' missing or blank?");
  return;
  }

var query = new Parse.Query(Parse.User);
query.get(
  invitorPersonId,
    {
    success: function(theInvitorPersonObject)
      {
      console.log("clientRequestFriendRemove ... internal I got the userObj ...('no response' mode)");

      if ( theMode == "accept" )
        {
        createOneNewHaf( thisUserObj, theInvitorPersonObject );
        createOneNewHaf( theInvitorPersonObject, thisUserObj );
        }

      // in both cases "accept" or "ignore", delete the invite in question:
      // and on top of that you have to do it both ways

      deleteFromInvites( theInvitorPersonObject, thisUserObj );
      deleteFromInvites( thisUserObj, theInvitorPersonObject );

      // (those further functions exist in the cloud code)

      // for now we'll just go with the trick of LETTING THOSE RUN
      // so DO NOT this ........... response.success( "removal attempt underway" );
      // it a huge problem with Parse that (so far, 2014) is poorly handled:
      // READ THIS:
      // parse.com/questions/can-i-use-a-cloud-code-function-within-another-cloud-code-function
      },
    error: function(object,error)
      {
      console.log("clientRequestAcceptInvite ... internal unusual failure: " + error.code + " " + error.message);
      response.error("Problem, internal problem?");
      return;
      }
    }
  );

}
);

( ... fooobar.com/questions/1097047/...)

3) , Push Parse, , " "

, Parse, Push...

function runAPush( ownerQueryForPush, description )
// literally run a push, given an ownerQuery
// (could be 1 to millions of devices pushed to)
    {
    var pushQuery = new Parse.Query(Parse.Installation);
    pushQuery.matchesQuery('owner', ownerQueryForPush);
    Parse.Push.send
        (
        {
        where: pushQuery,
        data:
            {
            swmsg: "reload",
            alert: description,
            badge: "Increment",
            title: "YourClient"
            }
        },
        {
        success: function()
{ console.log("did send push w txt message, to all..."); },
        error: function(error)
{ console.log("problem! sending the push"); }
        }
        );
    }

4) , , nosql. , Parse

5) ( , ) -

6) , , Parse ( , )

, , - . , .

+2

, CloudKit .

..

, . , , Daily, . Apple WWDC14 ( , ).

, push- . , : CKRecord Daily.

Crons

, , iCloud Dashboard, , . Mac- ( , mac mini, CloudKit), Daily CKRecord.

, AFAIK , .

+2

All Articles