0

I want to get "ServerDate" on back4app.com using PFCloud. Currently I am facing the below issue:

Invalid function: "getServerDate" (Code: 141, Version: 1.13.0) When i used below code:

  [PFCloud callFunctionInBackground:@"getServerDate"
   withParameters:nil block:^(id object, NSError *error)
   {
      if (!error)
      {

          NSLog(@"%@",serverDate);
      }
      else
      {
          [self getServerCurrentDate];
      }
   }];

I am beginner Please Explain How to implement and get javascript code on objective c?

aircraft
  • 25,146
  • 28
  • 91
  • 166
ayushi
  • 101
  • 1
  • 11

1 Answers1

1

Error you getting is becasue you don't have a function in your main.js file called "getServerDate".

Make sure you have it defined correctly as follows in your main.js file:

Parse.Cloud.define("getServerDate", function(request,response){

//Your javascript logic comes here and return the server date to the response

});
Cliffordwh
  • 1,422
  • 1
  • 10
  • 18