由sms切换阿里短信验证码,去除语音验证码

This commit is contained in:
kai60 2021-07-03 22:27:05 +08:00
parent 3f5ee249b5
commit 6f07bde049
7 changed files with 113 additions and 79 deletions

View File

@ -15817,7 +15817,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES;
@ -15935,7 +15935,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES;

View File

@ -185,7 +185,7 @@
addPhoneNumber:(NSString*)phoneNumber
addSendType:(NSString*)sendType
backData:(backVerifyCode)backVerifyCodeblock{
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"语音验证码"];
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"短信验证码"];
[self getverifyWithTimerButton:timeBtn addphoneNumber:phoneNumber AddSendType:sendType backData:backVerifyCodeblock];
}
@ -267,6 +267,7 @@
if ([reDic[@"result"] isEqualToString:@"100"]) {
backVerifyCodeblock(verifyData);
[self showTitle:@"" messsage:@"验证码发送成功"];
}else if([reDic[@"result"] isEqualToString:@"101"]){
dispatch_source_cancel(_timer1);

View File

@ -92,7 +92,7 @@
-(void)showTitle:(NSString*)title messsage:(NSString*)message{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"cancel Action");
}];
[alertController addAction:cancelAction];

View File

@ -118,12 +118,12 @@
[userdefult synchronize];
[self getVerifycode];
[self getAliVerify];
}
#pragma mark - SMS
#pragma mark -
-(void)getVerifycode{
@ -135,7 +135,7 @@
}
#define mark -
#define mark - 使
-(void)getAliVerify{
@ -202,25 +202,40 @@
return;
}
__weak typeof(self)weakSelf=self;
[SMSSDK commitVerificationCode:weakSelf.verifyTextFiled.text phoneNumber:weakSelf.phoneNumberFiled.text zone:weakSelf.areaCode result:^(NSError *error) {
if (_verifyData.length&&[self.verifyTextFiled.text isEqualToString:_verifyData])
{
{
if (!error)
{
NSLog(@"验证成功");
ResetViewController*vc=[[ResetViewController alloc]init];
[weakSelf.navigationController pushViewController:vc animated:YES];
}
else
{
NSLog(@"错误信息:%@",error);
NSString *str =@"验证码验证失败";
[self.view makeToast:str];
}
}
}];
NSLog(@"验证成功");
ResetViewController*vc=[[ResetViewController alloc]init];
[weakSelf.navigationController pushViewController:vc animated:YES];
}
else
{
NSString *str =@"验证码验证失败";
[self.view makeToast:str];
}
// [SMSSDK commitVerificationCode:weakSelf.verifyTextFiled.text phoneNumber:weakSelf.phoneNumberFiled.text zone:weakSelf.areaCode result:^(NSError *error) {
//
// {
// if (!error)
// {
//
// NSLog(@"验证成功");
// ResetViewController*vc=[[ResetViewController alloc]init];
// [weakSelf.navigationController pushViewController:vc animated:YES];
//
// }
// else
// {
// NSLog(@"错误信息:%@",error);
// NSString *str =@"验证码验证失败";
// [self.view makeToast:str];
// }
// }
// }];
}

View File

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -47,7 +45,7 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ONp-Rz-9VY">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ONp-Rz-9VY">
<rect key="frame" x="25" y="191" width="283" height="43"/>
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
@ -64,7 +62,7 @@
<rect key="frame" x="222" y="121" width="86" height="42"/>
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<state key="normal" title="语音验证码">
<state key="normal" title="短信验证码">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
@ -87,7 +85,7 @@
<constraint firstAttribute="width" constant="212" id="mfY-IJ-ZE0"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<state key="normal" title="区号">
<state key="normal" title="中国+86">
<color key="titleColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
@ -102,7 +100,7 @@
<constraint firstItem="4t2-r8-Y7e" firstAttribute="centerY" secondItem="Kuc-iA-yGB" secondAttribute="centerY" id="wUe-7b-dhI"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PNt-YY-iAQ">
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PNt-YY-iAQ">
<rect key="frame" x="246" y="241" width="62" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<state key="normal" title="短信验证码">

View File

@ -239,13 +239,13 @@ extern BOOL formLogIn;
}
- (IBAction)qrcodeSwithBtnClicked:(UIButton *)sender {
if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"语音验证码"]) {
[self.timeBtn setTitle:@"短信验证码" forState:UIControlStateNormal];
self.qrcodeSwitchLbl.text = @"语音验证码";
} else if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"短信验证码"]) {
[self.timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
self.qrcodeSwitchLbl.text = @"短信验证码";
}
// if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"语音验证码"]) {
// [self.timeBtn setTitle:@"短信验证码" forState:UIControlStateNormal];
// self.qrcodeSwitchLbl.text = @"语音验证码";
// } else if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"短信验证码"]) {
// [self.timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
// self.qrcodeSwitchLbl.text = @"短信验证码";
// }
}
#pragma mark-设置键盘样式
@ -447,35 +447,54 @@ extern BOOL formLogIn;
btn.userInteractionEnabled=NO;
btn.backgroundColor=[UIColor lightGrayColor];
[SMSSDK commitVerificationCode:self.verifyTextField.text phoneNumber:self.phoneNumberTextField.text zone:self.areaCode result:^(NSError *error) {
{
if (!error)
{
NSLog(@"验证成功");
if (self.isBind)
{
[self bindPhone];
}
else
{
[self ifishAddUser];
}
}
else
if ([self.verifyTextField.text isEqualToString:_verifyData])
{
if (self.isBind)
{
NSLog(@"错误信息:%@",error);
NSString *str =@"验证码验证失败";
[self.view makeToast:str];
btn.userInteractionEnabled=YES;
btn.backgroundColor=COLOR_LABEL_TITLE;
[self bindPhone];
}
else
{
[self ifishAddUser];
}
}
}
}];
}
else
{
NSString *str =@"验证码验证失败";
[self.view makeToast:str];
btn.userInteractionEnabled=YES;
btn.backgroundColor=COLOR_LABEL_TITLE;
}
// [SMSSDK commitVerificationCode:self.verifyTextField.text phoneNumber:self.phoneNumberTextField.text zone:self.areaCode result:^(NSError *error) {
//
// {
// if (!error)
// {
//
// NSLog(@"验证成功");
// if (self.isBind)
// {
// [self bindPhone];
// }
// else
// {
// [self ifishAddUser];
// }
//
//
// }
// else
// {
// NSLog(@"错误信息:%@",error);
// NSString *str =@"验证码验证失败";
// [self.view makeToast:str];
// btn.userInteractionEnabled=YES;
// btn.backgroundColor=COLOR_LABEL_TITLE;
//
// }
// }
// }];
}
@ -754,9 +773,10 @@ extern BOOL formLogIn;
}
- (IBAction)verifyBtn:(id)sender {
// [self timeFire];
//阿里验证码
[self timeFire];
[self getVerifycode];
// [self getVerifycode];
}
-(void)showTitle:(NSString*)title messsage:(NSString*)message{

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -44,7 +44,7 @@
<nil key="highlightedColor"/>
</label>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="enter_logo.png" translatesAutoresizingMaskIntoConstraints="NO" id="O0L-5W-OS6">
<rect key="frame" x="154.5" y="733.5" width="105" height="105"/>
<rect key="frame" x="181" y="786" width="52.5" height="52.5"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
</accessibility>
@ -79,7 +79,7 @@
<constraint firstAttribute="width" constant="80" id="N1G-p8-Udv"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="语音验证码" backgroundImage="registered_icon_validation.png">
<state key="normal" title="短信验证码" backgroundImage="registered_icon_validation.png">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@ -95,7 +95,7 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I52-cD-mf7">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I52-cD-mf7">
<rect key="frame" x="25" y="264" width="322" height="49"/>
<color key="backgroundColor" red="0.0" green="0.71764705882352942" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
@ -108,7 +108,7 @@
<action selector="registBtn:" destination="-1" eventType="touchUpInside" id="71r-yp-nJr"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LoQ-C1-iph">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LoQ-C1-iph">
<rect key="frame" x="25" y="322" width="16" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="RBU-vl-U55"/>
@ -119,7 +119,7 @@
<action selector="chooseBtn:" destination="-1" eventType="touchUpInside" id="fNS-Yb-Dfi"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pnt-Um-Tap">
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pnt-Um-Tap">
<rect key="frame" x="49" y="316" width="146" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="我已同意爱鱼奇使用协议">
@ -162,14 +162,14 @@
<constraint firstAttribute="width" secondItem="42g-iR-QpF" secondAttribute="height" multiplier="283:42" id="rdP-1c-cDT"/>
</constraints>
</view>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="短信验证码" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hT6-V3-AAb">
<label hidden="YES" opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="短信验证码" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hT6-V3-AAb">
<rect key="frame" x="195" y="322.5" width="61.5" height="15"/>
<gestureRecognizers/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JIR-jc-I5O" userLabel="QRSwitchBtn">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JIR-jc-I5O" userLabel="QRSwitchBtn">
<rect key="frame" x="196" y="313" width="152" height="61"/>
<connections>
<action selector="qrcodeSwithBtnClicked:" destination="-1" eventType="touchUpInside" id="pyz-qc-Ryt"/>