有没有一种以编程方式发送短信代码的方法?(没有Digits"魔术"视图控制器)
示例代码没有帮助。
// 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我从推特上得到了官方回应:
好问题!到目前为止,这还不是Digits内部构建的东西,但我们已经听到很多人在要求它
所以,现在是不可能的。但我删除这个问题并不是为了在调查同一问题时节省时间。或者有人可以帮助我解决
否。苹果不允许您以编程方式发送短信。为此,您需要连接到远程服务器。