BOGOAppDelegate.m 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // BOGOAppDelegate.m
  3. // BogoPayKit
  4. //
  5. // Created by fandongtongxue on 03/25/2020.
  6. // Copyright (c) 2020 fandongtongxue. All rights reserved.
  7. //
  8. #import "BOGOAppDelegate.h"
  9. @implementation BOGOAppDelegate
  10. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  11. {
  12. // Override point for customization after application launch.
  13. return YES;
  14. }
  15. - (void)applicationWillResignActive:(UIApplication *)application
  16. {
  17. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  18. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
  19. }
  20. - (void)applicationDidEnterBackground:(UIApplication *)application
  21. {
  22. // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  23. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  24. }
  25. - (void)applicationWillEnterForeground:(UIApplication *)application
  26. {
  27. // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
  28. }
  29. - (void)applicationDidBecomeActive:(UIApplication *)application
  30. {
  31. // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  32. }
  33. - (void)applicationWillTerminate:(UIApplication *)application
  34. {
  35. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  36. }
  37. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
  38. {
  39. if ([url.host isEqualToString:@"safepay"]) {
  40. // 支付跳转支付宝钱包进行支付,处理支付结果
  41. [[BogoPayManager defaultManager] handlePayURL:url callBack:^(BogoPayResponseModel * _Nonnull responseModel) {
  42. if (responseModel.isSuccess) {
  43. NSLog(@"支付成功");
  44. }else{
  45. NSLog(@"支付失败");
  46. }
  47. }];
  48. }
  49. return YES;
  50. }
  51. // NOTE: 9.0以后使用新API接口
  52. - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
  53. {
  54. if ([url.host isEqualToString:@"safepay"]) {
  55. // 支付跳转支付宝钱包进行支付,处理支付结果
  56. [[BogoPayManager defaultManager] handlePayURL:url callBack:^(BogoPayResponseModel * _Nonnull responseModel) {
  57. if (responseModel.isSuccess) {
  58. NSLog(@"支付成功");
  59. }else{
  60. NSLog(@"支付失败");
  61. }
  62. }];
  63. }
  64. return YES;
  65. }
  66. @end