错误通过解析发送twilio SMS

时间:2015-04-28 16:27:46

标签: objective-c xcode parse-platform twilio

我试图通过Twilio发送短信并解析,但是云功能会产生"哦,出了什么问题。"为什么? 这是xcode代码:

//Sends SMS via Parse Cloud code to a number....//TODO test, debug...
+(void)sendSMSWithVerificationCode:(NSString *)verificationString toNumberString:(NSString *)phoneNumber {
NSMutableString * message=[[NSMutableString alloc] initWithString:@"Brighten verification code: "];
[message appendString:verificationString];
// Call our Cloud Function that sends an SMS with Twilio
[PFCloud callFunctionInBackground:@"sendSMSVerification"
                   withParameters:@{ @"number" : phoneNumber , @"messageString" : message} 
                             block:^(id object, NSError *error) {
                                [[[UIAlertView alloc] initWithTitle:@"Verification code sent!"
                                                            message:nil
                                                           delegate:nil
                                                  cancelButtonTitle:@"Ok"
                                                      otherButtonTitles:nil, nil] show];
                            }];

}

,云功能如下:

twilio.initialize("meh",",mehh"); //these are for testing; todo insert real ones when deploying

// Create the Cloud Function
Parse.Cloud.define("sendSMSVerification", function(request, response) {

//使用Twilio Cloud Module发送短信

twilio.sendSMS({
     From: "111111111111111(my number as a string)",
To: request.params.number,
    Body: request.params.message //SMS Verification: 1234 or         whatever the specific number is...
  }, {
   success: function(httpResponse) { response.success("SMS sent!"); },
error: function(httpResponse) { response.error("Uh oh, something went wrong"); }

}); });

0 个答案:

没有答案