您的位置:首页 > 产品设计 > UI/UE

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

2016-01-18 13:05 393 查看
#pragma mark - UIApplicationDelegate-支付宝的回调

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

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

        [[AlipaySDK
defaultService]

         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.host
isEqualToString:@"safepay"]) {//
支付宝钱包

        [[AlipaySDK
defaultService]

         processOrderWithPaymentResult:url

         standbyCallback:^(NSDictionary *resultDic) {

         }];

        

    }

    [[IFlySpeechUtility
getUtility] handleOpenURL:url];

    return
YES;

    

//

if (IAIOS8)

    {

        UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:title message:message
preferredStyle:UIAlertControllerStyleAlert];

        if (self.tag
== LEFT_ALERTMESSAGE)

        {

            NSArray *views = [self
viewArray:alertController.view];

            UILabel *title = views[1];

            title.textAlignment =
NSTextAlignmentLeft;

            [ToolsUtil
setAlertToolParagraph:title];

        }

        if(cancelButtonTitle !=
nil)

        {

            UIAlertAction *cancelAction = [UIAlertAction
actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action) {

                TheAppDel.currAlertController =
nil;

                if (cancel)

                {

                    cancel();

                }

            }];

            [alertController addAction:cancelAction];

        }

        if (otherButtonTitle !=nil) {

            UIAlertAction *otherAction = [UIAlertAction
actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {

                TheAppDel.currAlertController =
nil;

                if (confirm)

                {

                    confirm();

                }

            }];

            [alertController addAction:otherAction];

        }

        // Add the actions.

        [viewController presentViewController:alertController
animated:YES
completion:nil];

        self.confirmParam=confirm;

        self.cancelParam=cancel;

        

        TheAppDel.currAlertController = alertController;

    }

    else

    {

        UIAlertView *alertView=[[UIAlertView
alloc]initWithTitle:title
message:message delegate:viewController
cancelButtonTitle: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;

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios 支付宝