Kaynağa Gözat

Merge branch 'dev' of https://git.yishihui.com/iOS/MusicVideoPlus into dev

# Conflicts:
#	Podfile
合并代码
jsonwang 3 yıl önce
ebeveyn
işleme
d9f78a4ebc

+ 26 - 26
MusicVideoPlus/AppDelegate.swift

@@ -58,34 +58,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     }
     
     func applicationWillResignActive(_ application: UIApplication) {
-        BFLog(message: "applicationDidEnterBackground")
-        DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + 1) {
-            // 继续播放其他音乐
-            do {
-                try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
-                BFLog(message: "关闭声音活跃继续播放其他音乐成功")
-            } catch {
-                BFLog(message: "关闭声音活跃继续播放其他音乐失败:\(error)")
-            }
-        }
+        BFLog(message: "applicationWillResignActive")
+//        DispatchQueue.main.async {
+//            // 继续播放其他音乐
+//            do {
+//                try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
+//                BFLog(message: "关闭声音活跃继续播放其他音乐成功")
+//            } catch {
+//                BFLog(message: "关闭声音活跃继续播放其他音乐失败:\(error)")
+//            }
+//        }
     }
     func applicationWillEnterForeground(_ application: UIApplication) {
-        BFLog(message: "applicationDidBecomeActive")
-        DispatchQueue.global().async {
-            let session = AVAudioSession.sharedInstance()
-            do {
-                try session.setCategory(.playback)
-                try session.setActive(true, options: .notifyOthersOnDeactivation)
-                BFLog(message: "打开声音活跃关闭其他音乐播放成功")
-            } catch {
-                BFLog(message: "打开声音活跃关闭其他音乐播放失败:\(error)")
-            }
-        }
-    }
-
-    func applicationDidBecomeActive(_: UIApplication) {
-//        BFLog(message: "applicationDidBecomeActive")
-//        DispatchQueue.global().async {
+        BFLog(message: "applicationWillEnterForeground")
+//        DispatchQueue.main.async {
 //            let session = AVAudioSession.sharedInstance()
 //            do {
 //                try session.setCategory(.playback)
@@ -96,4 +82,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 //            }
 //        }
     }
+
+    func applicationDidBecomeActive(_: UIApplication) {
+        BFLog(message: "applicationDidBecomeActive")
+        DispatchQueue.main.async {
+            let session = AVAudioSession.sharedInstance()
+            do {
+                try session.setCategory(.playback, mode: .moviePlayback)
+                try session.setActive(true)
+                BFLog(message: "打开声音活跃关闭其他音乐播放成功")
+            } catch{
+                BFLog(1, message: "打开声音活跃关闭其他音乐播放失败:\(error)")
+            }
+        }
+    }
 }

+ 1 - 1
MusicVideoPlus/Classes/Modules/Home/Controllers/MVHomeController.swift

@@ -278,7 +278,7 @@ class MVHomeController: MVBaseController {
             }
             UIApplication.shared.keyWindow?.addSubview(protocalView)
         }
-        try? AVAudioSession.sharedInstance().setCategory(.playback)
+//        try? AVAudioSession.sharedInstance().setCategory(.playback)
     }
 
     func addLayout() {

+ 1 - 1
MusicVideoPlus/Classes/Modules/Mine/Controllers/MVMineProductController.swift

@@ -117,7 +117,7 @@ class MVMineProductController: PQBaseViewController {
             if (videoList?.count ?? 0) < 20, videoList != nil {
                 self?.collectionView.mj_footer?.endRefreshingWithNoMoreData()
             }
-            PQLoadingHUB.shared.dismissHUB(superView:(self?.view)!)
+            PQLoadingHUB.shared.dismissHUB(superView:(self?.view ?? UIView()))
            
         }
     }

+ 3 - 3
Podfile

@@ -3,11 +3,11 @@ platform :ios, '10.0'
 target 'MusicVideoPlus' do
   # Comment the next line if you don't want to use dynamic frameworks
   use_frameworks!
-#  source 'https://github.com/CocoaPods/Specs.git'
+  #source 'https://github.com/CocoaPods/Specs.git'
   source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
   source 'https://git.yishihui.com/iOS/BFSpecs.git'
 #  pod "BFFramework" ,:git => 'https://git.yishihui.com/iOS/BFFramework.git', :tag => '1.0.4'
- 
+
    #使用主分支的最新代码
    pod "BFMaterialKit" ,:git => 'https://git.yishihui.com/iOS/BFMaterialKit.git'
    pod "BFCommonKit" ,:git => 'https://git.yishihui.com/iOS/BFCommonKit.git'
@@ -20,7 +20,7 @@ target 'MusicVideoPlus' do
 # pod 'BFCommonKit', :path => '../BFCommonKit/'
 # pod 'BFNetRequestKit', :path => '../BFNetRequestKit/'
 # pod 'BFFramework', :path => '../BFFramework/'
- 
+
 
    pod 'JWTDecode','2.6.0' # Apple登陆校验库
    pod 'TYAttributedLabel','2.6.9' #  富文本