diff --git a/relax.offline.mp3.music.xcworkspace/xcuserdata/zhou.xcuserdatad/UserInterfaceState.xcuserstate b/relax.offline.mp3.music.xcworkspace/xcuserdata/zhou.xcuserdatad/UserInterfaceState.xcuserstate index 20978e9..f41e827 100644 Binary files a/relax.offline.mp3.music.xcworkspace/xcuserdata/zhou.xcuserdatad/UserInterfaceState.xcuserstate and b/relax.offline.mp3.music.xcworkspace/xcuserdata/zhou.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/relax.offline.mp3.music/AppDelegate.swift b/relax.offline.mp3.music/AppDelegate.swift index 773e00b..bc0a7fb 100644 --- a/relax.offline.mp3.music/AppDelegate.swift +++ b/relax.offline.mp3.music/AppDelegate.swift @@ -56,9 +56,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { MP_NetWorkManager.shared.requestStatusToYouTube() IQKeyboardManager.shared.enable = true IQKeyboardManager.shared.shouldResignOnTouchOutside = true - //启用内购项 - MP_IAPManager.shared.observeVIPStoreKit() - MP_IAPManager.shared.getVIPAllProducts() window = UIWindow(frame: UIScreen.main.bounds) window?.backgroundColor = .init(hex: "#161616") //关联faceBook diff --git a/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift b/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift index ccfc0c7..690ef06 100644 --- a/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift +++ b/relax.offline.mp3.music/MP/Common/Base(公用基类)/Controllers/MP_LunchViewController.swift @@ -116,6 +116,9 @@ class MP_LunchViewController: UIViewController { private func switchAOrBAction() { //首先检测之前是否进入过B面 guard UserDefaults.standard.bool(forKey: "MP_Into_B") != true else { + //启用内购项 + MP_IAPManager.shared.observeVIPStoreKit() + MP_IAPManager.shared.getVIPAllProducts() loadAds() //更新开关以及响应的数据 MP_AnalyticsManager.shared.getOpenStatus(0) { open in @@ -153,6 +156,9 @@ class MP_LunchViewController: UIViewController { MP_NetWorkManager.shared.performTaskNetWrokAvailable { [weak self] in guard let self = self else {return} + //启用内购项 + MP_IAPManager.shared.observeVIPStoreKit() + MP_IAPManager.shared.getVIPAllProducts() //广告加载 loadAds() //进行开关检测 diff --git a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_IAPManager.swift b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_IAPManager.swift index e472f79..495d73b 100644 --- a/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_IAPManager.swift +++ b/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_IAPManager.swift @@ -38,6 +38,8 @@ class MP_IAPManager: NSObject { } ///校正内购产品交易情况 func observeVIPStoreKit() { + //检索本地是否存在旧版交易记录 +// guard //清理原有的交易信息组 transactions.removeAll() //执行交易信息组校正处理 @@ -89,24 +91,6 @@ class MP_IAPManager: NSObject { } } -// ///执行产品请求 -// func requestProducts() { -// guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { -// //无网络 -// print("无网络状况,无法获得产品") -// return -// } -// //清空可用产品 -// availableProducts = [] -// //将产品ID转为Set集合 -// let setStrings:Set = Set(productIdentifiers) -// //初始化产品请求 -// productsRequest = SKProductsRequest(productIdentifiers: setStrings) -// //实现请求代理 -// productsRequest?.delegate = self -// //开始执行请求 -// productsRequest?.start() -// } ///对指定产品进行购买 func purchaseProduct(with productId:String) { showHUD = true @@ -123,7 +107,6 @@ class MP_IAPManager: NSObject { } } - ///用户重新检索交易 func restorePurchases() { MP_HUD.loading()