简体   繁体   中英

Twitter Digits: How to send conformation code (sms) programmatically?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM