0

Is there a way to send sms code programmatically? (Without Digits "magic" view controllers)

The example code doesn't help.

// Objective-C
- (void)didTapButton {
    Digits *digits = [Digits sharedInstance];
    DGTAuthenticationConfiguration *configuration = [[DGTAuthenticationConfiguration alloc] initWithAccountFields:DGTAccountFieldsDefaultOptionMask];
    configuration.phoneNumber = @"+345555555555";
    [digits authenticateWithViewController:nil configuration:configuration completion:^(DGTSession *newSession, NSError *error){
    // Country selector will be set to Spain and phone number field will be set to 5555555555
}];

}

I found a method authenticateWithPhoneNumber in [Digits sharedInstance], but it's look like it have been deprecated

- (void)authenticateWithPhoneNumber:(twtr_nullable NSString *)phoneNumber digitsAppearance:(twtr_nullable DGTAppearance *)appearance 
viewController:(twtr_nullable UIViewController *)viewController
title:(twtr_nullable NSString *)title completion:(DGTAuthenticationCompletion)completion 
__attribute__((deprecated("Use authenticateWithViewController:configuration:completion: instead.")));

UPD I got kind of official response from Twitter:

Great question! As of now, this isn't something that's currently built out inside Digits, but it is something that we've heard quite a few people asking for.

So, it's not possible right now. But I'm not deleting the question for save someone time during investigation for the same issue. Or may be someone can help me with workaround

1 Answers1

-1

No. Apple does not allow you to send SMS messages programmatically. You need to connect to a remote server for that.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
  • I'm pretty sure that Apple does not provide any sms server. I have used Twilio before, but can't find message to send sms programmatically via Twitter Digits – Anthony Marchenko Nov 20 '15 at 19:54
  • Apple does not an sms server or other API that you can use programmatically. That is by design. What they provide is an API where you can display an SMS to the user, and the user clicks a send button to transmit the text. Take a look at `MFMessageComposeViewController` in the Xcode docs. See this link for more info: http://stackoverflow.com/questions/10848/how-to-programmatically-send-sms-on-the-iphone – Duncan C Nov 20 '15 at 20:58