objective c - Code 141 error Parse Twilio SMS cloud function -
my console logging error when try send sms phone:
[error]: uh oh, went wrong (code: 141, version: 1.7.1) what problem? it's error 141 understand response.success inclusion-affiliated error, honestly, included response.success it's not clear me problem here. appreciated.
code in xcode
nsdictionary *params = [nsdictionary dictionarywithobject:number forkey:@"number"]; [pfcloud callfunctioninbackground:@"sendsmsverification" withparameters:params block:^(id object, nserror *error) { nsstring *message = @""; if (!error) { message = @"your sms invitation has been sent!"; } else { message = @"uh oh, went wrong :("; } [[[uialertview alloc] initwithtitle:@"verification code sent!" message:message delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil, nil] show]; }]; and cloud function:
// include twilio cloud module , initialize var twilio = require("twilio"); twilio.initialize("****","*****"); //these testing; todo insert real ones when deploying // create cloud function parse.cloud.define("sendsmsverification", function(request, response) { // use twilio cloud module send sms twilio.sendsms({ from: "1##########", to: request.params.number, body: "test" //request.params.message// sms verification: 1234 or whatever specific number is... }, { success: function(httpresponse) { response.success("sms sent!"); }, error: function(httpresponse) { response.error("uh oh, went wrong"); } }); });
this cloud code working me.
var client = require('twilio')('<your twilio account sid>', '<your twilio auth token>'); // send sms message client.sendsms( { to:'number', from: 'number', body: "your verification code " + verificationcode + "." }, function(err,responsedata) { if (err) { } else { response.error(verificationcode); } } ); response.success(verificationcode); }); if using free twilio account make sure number verified twilio.
i follow this tutorial send sms , worked me. try follow this.
hope you.
Comments
Post a Comment