0

有没有办法以编程方式发送短信代码?(没有数字“魔术”视图控制器)

示例代码没有帮助。

// 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
}];

}

我在 [Digits sharedInstance] 中找到了一个方法 authenticateWithPhoneNumber,但它看起来已被弃用

- (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我得到了 Twitter 的官方回应:

好问题!到目前为止,这不是目前在 Digits 内部构建的东西,但我们已经听到很多人要求它。

所以,目前是不可能的。但我不会删除这个问题,以便在调查同一问题时节省一些时间。或者可能有人可以帮助我解决问题

4

1 回答 1

-1

不可以。Apple 不允许您以编程方式发送 SMS 消息。为此,您需要连接到远程服务器。

于 2015-11-20T19:52:35.790 回答