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;
}
}
- (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;
}
}
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- 讲解iOS开发中基本的定位功能实现
- js判断客户端是iOS还是Android等移动终端的方法
- IOS开发环境windows化攻略
- 浅析iOS应用开发中线程间的通信与线程安全问题
- 检测iOS设备是否越狱的方法
- C#支付宝扫码支付代码完整版
- .net平台推送ios消息的实现方法
- jquery图片轮播插件仿支付宝2013版全屏图片幻灯片
- 基于OpenCart 开发支付宝,财付通,微信支付参数错误问题
- 探讨Android与iOS,我们将何去何从?
- Android仿微信/支付宝密码输入框
- Android支付宝支付封装代码
- Android、iOS和Windows Phone中的推送技术详解