iOS9之后支付宝的回调以及iOS8之后提示框UIAlertController

来源:互联网 发布:电子网络发票系统下载 编辑:程序博客网 时间:2024/06/06 13:20

#pragma mark - UIApplicationDelegate-支付宝的回调

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullableNSString *)sourceApplication annotation:(id)annotationNS_DEPRECATED_IOS(4_2,9_0, "Please use application:openURL:options:"){


    if ([url.hostisEqualToString:@"safepay"]) {//支付宝钱包

        [[AlipaySDKdefaultService]

         processOrderWithPaymentResult:url

         standbyCallback:^(NSDictionary *resultDic) {

         }];

        

    }

//    [[IFlySpeechUtility getUtility] handleOpenURL:url];

    return YES;

}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*,id> *)options NS_AVAILABLE_IOS(9_0)

{


//////////////////////

    if ([url.hostisEqualToString:@"safepay"]) {//支付宝钱包

        [[AlipaySDKdefaultService]

         processOrderWithPaymentResult:url

         standbyCallback:^(NSDictionary *resultDic) {

         }];

        

    }

    [[IFlySpeechUtilitygetUtility] handleOpenURL:url];

    return YES;

    

//

if (IAIOS8)

    {

        UIAlertController *alertController = [UIAlertControlleralertControllerWithTitle:title message:messagepreferredStyle:UIAlertControllerStyleAlert];

        if (self.tag == LEFT_ALERTMESSAGE)

        {

            NSArray *views = [selfviewArray:alertController.view];

            UILabel *title = views[1];

            title.textAlignment =NSTextAlignmentLeft;

            [ToolsUtilsetAlertToolParagraph:title];

        }

        if(cancelButtonTitle != nil)

        {

            UIAlertAction *cancelAction = [UIAlertActionactionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancelhandler:^(UIAlertAction *action) {

                TheAppDel.currAlertController =nil;

                if (cancel)

                {

                    cancel();

                }

            }];

            [alertController addAction:cancelAction];

        }

        if (otherButtonTitle !=nil) {

            UIAlertAction *otherAction = [UIAlertActionactionWithTitle:otherButtonTitle style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *action) {

                TheAppDel.currAlertController =nil;

                if (confirm)

                {

                    confirm();

                }

            }];

            [alertController addAction:otherAction];

        }

        // Add the actions.

        [viewController presentViewController:alertControlleranimated:YEScompletion:nil];

        self.confirmParam=confirm;

        self.cancelParam=cancel;

        

        TheAppDel.currAlertController = alertController;

    }

    else

    {

        UIAlertView *alertView=[[UIAlertViewalloc]initWithTitle:titlemessage:message delegate:viewControllercancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitle, nil];

        [alertView show];

        if (cancelButtonTitle==nil)

        {

            self.confirmParam=cancel;

            self.cancelParam=confirm;

            

        }else

        {

            self.confirmParam=confirm;

            self.cancelParam=cancel;

        }

        

        TheAppDel.currAlertView = alertView;

    }


}

0 0
原创粉丝点击