Pārlūkot izejas kodu

合并分支 fix error

huzhiqiang 3 gadi atpakaļ
vecāks
revīzija
d93828649c

+ 0 - 179
BFFramework/Classes/BFModules/BFCategorys/BFUIButton+ext.swift

@@ -1,179 +0,0 @@
-//
-//  UIButton+ext.swift
-//  PQSpeed
-//
-//  Created by ak on 2020/8/14.
-//  Copyright © 2020 BytesFlow. All rights reserved.
-//
-/**
- UIButton图像文字同时存在时---图像相对于文字的位置
-
- - top:    图像在上
- - left:   图像在左
- - right:  图像在右
- - bottom: 图像在下
- */
-public enum PQButtonImageEdgeInsetsStyle {
-    case top, left, right, bottom
-}
-
-import Foundation
-extension UIButton {
-    public func imagePosition(at style: PQButtonImageEdgeInsetsStyle, space: CGFloat) {
-        guard let imageV = imageView else { return }
-        guard let titleL = titleLabel else { return }
-        // 获取图像的宽和高
-        let imageWidth = imageV.frame.size.width
-        let imageHeight = imageV.frame.size.height
-        // 获取文字的宽和高
-        let labelWidth = titleL.frame.size.width
-        let labelHeight = titleL.frame.size.height
-
-        var imageEdgeInsets = UIEdgeInsets.zero
-        var labelEdgeInsets = UIEdgeInsets.zero
-        // UIButton同时有图像和文字的正常状态---左图像右文字,间距为0
-        switch style {
-        case .left:
-            // 正常状态--只不过加了个间距
-            imageEdgeInsets = UIEdgeInsets(top: 0, left: -space * 0.5, bottom: 0, right: space * 0.5)
-            labelEdgeInsets = UIEdgeInsets(top: 0, left: space * 0.5, bottom: 0, right: -space * 0.5)
-        case .right:
-            // 切换位置--左文字右图像
-            // 图像:UIEdgeInsets的left是相对于UIButton的左边移动了labelWidth + space * 0.5,right相对于label的左边移动了-labelWidth - space * 0.5
-            imageEdgeInsets = UIEdgeInsets(top: 0, left: labelWidth + space * 0.5, bottom: 0, right: -labelWidth - space * 0.5)
-            labelEdgeInsets = UIEdgeInsets(top: 0, left: -imageWidth - space * 0.5, bottom: 0, right: imageWidth + space * 0.5)
-        case .top:
-            // 切换位置--上图像下文字
-            /** 图像的中心位置向右移动了labelWidth * 0.5,向上移动了-imageHeight * 0.5 - space * 0.5
-              *文字的中心位置向左移动了imageWidth * 0.5,向下移动了labelHeight*0.5+space*0.5
-             */
-            imageEdgeInsets = UIEdgeInsets(top: -(imageHeight * 0.5 - space), left: labelWidth * 0.5, bottom: imageHeight * 0.5 - space, right: -labelWidth * 0.5)
-            labelEdgeInsets = UIEdgeInsets(top: labelHeight * 0.5 + space * 2, left: -imageWidth * 0.5, bottom: -(labelHeight * 0.5 + space * 2), right: imageWidth * 0.5)
-        case .bottom:
-            // 切换位置--下图像上文字
-            /** 图像的中心位置向右移动了labelWidth * 0.5,向下移动了imageHeight * 0.5 + space * 0.5
-             *文字的中心位置向左移动了imageWidth * 0.5,向上移动了labelHeight*0.5+space*0.5
-             */
-            imageEdgeInsets = UIEdgeInsets(top: imageHeight * 0.5 + space * 0.5, left: labelWidth * 0.5, bottom: -imageHeight * 0.5 - space * 0.5, right: -labelWidth * 0.5)
-            labelEdgeInsets = UIEdgeInsets(top: -labelHeight * 0.5 - space * 0.5, left: -imageWidth * 0.5, bottom: labelHeight * 0.5 + space * 0.5, right: imageWidth * 0.5)
-        }
-        titleEdgeInsets = labelEdgeInsets
-        self.imageEdgeInsets = imageEdgeInsets
-    }
-}
-
-/*
-   e.g.
- let button = UIButton(frame: CGRect(x: 0, y: 300, width: 100, height: 22))
- button.setTitle("按钮", for: .normal)
- button.setTitleColor(.black, for: .normal)
- button.eventInterval = 2.0  //  按的时间间隔, 设置为0的时候就是可以反复点击
- view.addSubview(button)
- 
- */
-// MARK: - 按钮的反复点击问题 交换方法
-extension UIButton {
-
-    /// 对外交换方法的方法 AppDelegate Launch中使用
-    public  static func methodExchange() {
-        DispatchQueue.once(token: "UIButton") {
-            let originalSelector = Selector.sysFunc
-            let swizzledSelector = Selector.myFunc
-            changeMethod(originalSelector, swizzledSelector, self)
-        }
-    }
-    
-    
-    /// Runtime方法交换
-    ///
-    /// - Parameters:
-    ///   - original: 原方法
-    ///   - swizzled: 交换方法
-    ///   - object: 对象
-    public static func changeMethod(_ original: Selector, _ swizzled: Selector, _ object: AnyClass) -> () {
-        
-        guard let originalMethod = class_getInstanceMethod(object, original),
-              let swizzledMethod = class_getInstanceMethod(object, swizzled) else {
-            return
-        }
-        
-        let didAddMethod = class_addMethod(object, original, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))
-        if didAddMethod {
-            class_replaceMethod(object, swizzled, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod))
-        } else {
-            method_exchangeImplementations(originalMethod, swizzledMethod)
-        }
-    }
-    
-    
-    /// 结构体静态key
-    public struct UIButtonKey {
-        static var isEventUnavailableKey = "isEventUnavailableKey"
-        static var eventIntervalKey = "eventIntervalKey"
-    }
-    
-    /// 触发事件的间隔
-    public var eventInterval: TimeInterval {
-        get {
-            return (objc_getAssociatedObject(self, &UIButtonKey.eventIntervalKey) as? TimeInterval) ?? 0
-        }
-        set {
-            objc_setAssociatedObject(self, &UIButtonKey.eventIntervalKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
-        }
-    }
-    
-    /// 是否可以触发事件
-    fileprivate var isEventUnavailable: Bool {
-        get {
-            return (objc_getAssociatedObject(self, &UIButtonKey.isEventUnavailableKey) as? Bool) ?? false
-        }
-        set {
-            objc_setAssociatedObject(self, &UIButtonKey.isEventUnavailableKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
-        }
-    }
-    
-    /// 手写的set方法
-    ///
-    /// - Parameter isEventUnavailable: 事件是否可用
-    @objc private func setIsEventUnavailable(_ isEventUnavailable: Bool) {
-        self.isEventUnavailable = isEventUnavailable
-    }
-    
-    /// mySendAction
-    @objc fileprivate func mySendAction(_ action: Selector, to target: Any?, for event: UIEvent?) {
-        print("交换了按钮事件的方法")
-        
-        if isEventUnavailable == false {
-            isEventUnavailable = true
-            mySendAction(action, to: target, for: event)
-            perform(#selector(setIsEventUnavailable(_: )), with: false, afterDelay: eventInterval)
-        }
-    }
-}
-
-fileprivate extension Selector {
-    static let sysFunc = #selector(UIButton.sendAction(_:to:for:))
-    static let myFunc = #selector(UIButton.mySendAction(_:to:for:))
-}
-
-extension DispatchQueue {
-    private static var onceTracker = [String]()
-    
-    open class func once(token: String, block:() -> ()) {
-        //注意defer作用域,调用顺序——即一个作用域结束,该作用域中的defer语句自下而上调用。
-        objc_sync_enter(self)
-        defer {
-            print("线程锁退出")
-            objc_sync_exit(self)
-        }
-        
-        if onceTracker.contains(token) {
-            return
-        }
-        onceTracker.append(token)
-        block()
-        defer {
-            print("block执行完毕")
-        }
-    }
-}

+ 0 - 255
BFFramework/Classes/BFModules/BFCategorys/BFUIImage+Ext.swift

@@ -1,255 +0,0 @@
-//
-//  UIImage+Ext.swift
-//  PQSpeed
-//
-//  Created by SanW on 2020/6/19.
-//  Copyright © 2020 BytesFlow. All rights reserved.
-//
-
-import Foundation
-
-public extension UIImage {
-    // 从BFframwork bundle 中取图片
-    func BF_Image(named: String) -> UIImage {
-        let image: UIImage = UIImage(named: named, in: Bundle().BF_mainbundle(), compatibleWith: nil) ?? UIImage()
-        return image
-    }
-
-    func cropImage(ratio: CGFloat) -> UIImage {
-        // 计算最终尺寸
-        let newSize: CGSize = CGSize(width: size.width, height: size.width * ratio)
-        // 图片绘制区域
-        var rect = CGRect.zero
-        rect.size.width = size.width
-        rect.size.height = size.height
-        rect.origin.x = (newSize.width - size.width) / 2.0
-        rect.origin.y = (newSize.height - size.height) / 2.0
-
-        UIGraphicsBeginImageContext(newSize)
-        draw(in: rect)
-        let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
-        UIGraphicsEndImageContext()
-
-        return scaledImage!
-    }
-
-    func cropImage(newSize: CGSize) -> UIImage {
-        //// 图片绘制区域
-        var rect = CGRect.zero
-        rect.size.width = newSize.width
-        rect.size.height = newSize.width * (size.height / size.width)
-        // 绘制并获取最终图片
-        UIGraphicsBeginImageContext(newSize)
-        draw(in: rect)
-        let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
-        UIGraphicsEndImageContext()
-
-        return scaledImage!
-    }
-
-    func imageWithImage(scaledToSize newSize: CGSize) -> UIImage {
-        UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0)
-        draw(in: CGRect(origin: CGPoint.zero, size: newSize))
-        let newImage = UIGraphicsGetImageFromCurrentImageContext() ?? self
-        UIGraphicsEndImageContext()
-        return newImage
-    }
-
-    /// 旋转角度
-    /// - Parameter image: <#image description#>
-    /// - Returns: <#description#>
-    func rotateImage(rotate: Int, originWidth: CGFloat, originHeight: CGFloat) -> UIImage {
-        let rotate: CGFloat = CGFloat(3 * Double.pi / 2)
-        let rect = CGRect(x: 0, y: 0, width: originWidth, height: originHeight)
-        let translateX: CGFloat = -rect.size.height
-        let translateY: CGFloat = 0
-        let scaleY = rect.size.width / rect.size.height
-        let scaleX = rect.size.height / rect.size.width
-        UIGraphicsBeginImageContext(rect.size)
-        let context = UIGraphicsGetCurrentContext()
-        //        context!.translateBy(x: 0.0, y: rect.size.height)
-        //        context!.scaleBy(x: 1.0, y: -1.0)
-        context!.rotate(by: rotate)
-        context!.translateBy(x: translateX, y: translateY)
-        context!.scaleBy(x: scaleX, y: scaleY)
-        draw(in: CGRect(x: 0, y: 0, width: rect.size.width, height: rect.size.height))
-        return UIGraphicsGetImageFromCurrentImageContext()!
-    }
-
-    /// 生成三角图
-    /// - Parameters:
-    ///   - size: <#size description#>
-    ///   - tintColor: <#tintColor description#>
-    ///   - convert:是否倒置
-    /// - Returns: <#description#>
-    class func triangleImage(size: CGSize, tintColor: UIColor, direction: moveDirection = .moveDirectionDown) -> UIImage {
-        var startPoint: CGPoint = CGPoint.zero
-        var middlePoint: CGPoint = CGPoint.zero
-        var endPoint: CGPoint = CGPoint.zero
-        switch direction {
-        case .moveDirectionLeft:
-            startPoint = CGPoint(x: size.width, y: 0)
-            middlePoint = CGPoint(x: 0, y: size.height / 2.0)
-            endPoint = CGPoint(x: size.width, y: size.height)
-        case .moveDirectionRight:
-            startPoint = CGPoint(x: 0, y: 0)
-            middlePoint = CGPoint(x: size.width, y: size.height / 2.0)
-            endPoint = CGPoint(x: 0, y: size.height)
-        case .moveDirectionUp:
-            startPoint = CGPoint(x: 0, y: size.height)
-            middlePoint = CGPoint(x: size.width / 2.0, y: 0)
-            endPoint = CGPoint(x: size.width, y: size.height)
-        default:
-            startPoint = CGPoint(x: 0, y: 0)
-            middlePoint = CGPoint(x: size.width / 2.0, y: size.height)
-            endPoint = CGPoint(x: size.width, y: 0)
-        }
-        UIGraphicsBeginImageContextWithOptions(size, false, 0)
-        let ctx = UIGraphicsGetCurrentContext()
-        let path = UIBezierPath()
-        path.move(to: startPoint)
-        path.addLine(to: middlePoint)
-        path.addLine(to: endPoint)
-        path.close()
-        ctx?.setFillColor(tintColor.cgColor)
-        path.fill()
-        let image = UIGraphicsGetImageFromCurrentImageContext()!
-        UIGraphicsEndImageContext()
-        return image
-    }
-
-    /// 按照最短边缩放  add by ak
-    /// - Parameter maxLength: 边长最大值
-    func nx_scaleWithMaxLength(maxLength: CGFloat) -> UIImage {
-        if size.width > maxLength || size.height > maxLength {
-            var maxWidth: CGFloat = maxLength
-            var maxHeight: CGFloat = maxLength
-
-            if size.width != size.height {
-                if size.width > size.height {
-                    // 按照宽 来缩放
-                    let imageScale: CGFloat = maxLength / size.width
-
-                    maxHeight = size.height * imageScale
-                } else if size.width < size.height {
-                    let imageScale: CGFloat = maxLength / size.height
-
-                    maxWidth = size.width * imageScale
-                }
-            }
-            // 返回新的改变大小后的图片
-            return nx_scaleToSize(size: CGSize(width: maxWidth, height: maxHeight))
-        }
-
-        return self
-    }
-
-    /// 缩放到指定大小 add by ak
-    /// - Parameter size: 新的大小
-    func nx_scaleToSize(size: CGSize) -> UIImage {
-        var width: CGFloat = CGFloat(cgImage!.width)
-        var height: CGFloat = CGFloat(cgImage!.height)
-
-        let verticalRadio: CGFloat = size.height * 1.0 / height
-        let horizontalRadio: CGFloat = size.width * 1.0 / width
-
-        var radio: CGFloat = 1
-        if verticalRadio > 1, horizontalRadio > 1 {
-            radio = verticalRadio > horizontalRadio ? horizontalRadio : verticalRadio
-        } else {
-            radio = verticalRadio < horizontalRadio ? verticalRadio : horizontalRadio
-        }
-
-        width = width * radio
-        height = height * radio
-
-        let xPos: CGFloat = (size.width - width) / 2
-        let yPos: CGFloat = (size.height - height) / 2
-
-        // 创建一个bitmap的context
-        // 并把它设置成为当前正在使用的context
-        UIGraphicsBeginImageContext(size)
-
-        // 绘制改变大小的图片
-        var rect = CGRect.zero
-        rect.size.width = ceil(width)
-        rect.size.height = ceil(height)
-        rect.origin.x = xPos
-        rect.origin.y = yPos
-
-        draw(in: rect)
-
-        // 从当前context中创建一个改变大小后的图片
-        let scaledImage: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
-
-        // 使当前的context出堆栈
-        UIGraphicsEndImageContext()
-
-        // 返回新的改变大小后的图片
-        return scaledImage
-    }
-
-    // 将图片裁剪成指定比例(多余部分自动删除)let image3 = image.crop(ratio: 1) /将图片转成 1:1 比例(正方形)
-    func nxcrop(ratio: CGFloat) -> UIImage {
-        // 计算最终尺寸
-        var newSize: CGSize!
-        if size.width / size.height > ratio {
-            newSize = CGSize(width: size.height * ratio, height: size.height)
-        } else {
-            newSize = CGSize(width: size.width, height: size.width / ratio)
-        }
-
-        ////图片绘制区域
-        var rect = CGRect.zero
-        rect.size.width = size.width
-        rect.size.height = size.height
-        rect.origin.x = (newSize.width - size.width) / 2.0
-        rect.origin.y = (newSize.height - size.height) / 2.0
-
-        // 绘制并获取最终图片
-        UIGraphicsBeginImageContext(newSize)
-        draw(in: rect)
-        let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
-        UIGraphicsEndImageContext()
-
-        return scaledImage!
-    }
-    
-    /// 改变图片主题颜色
-    /// - Parameters:
-    ///   - color: <#color description#>
-    ///   - blendMode: <#blendMode description#>
-    /// - Returns: <#description#>
-    func tintImage(color: UIColor, blendMode: CGBlendMode) -> UIImage? {
-        let rect = CGRect(origin: CGPoint.zero, size: size)
-        UIGraphicsBeginImageContextWithOptions(size, false, scale)
-        color.setFill()
-        UIRectFill(rect)
-        draw(in: rect, blendMode: blendMode, alpha: 1.0)
-        let tintedImage = UIGraphicsGetImageFromCurrentImageContext()
-        UIGraphicsEndImageContext()
-        return tintedImage
-    }
-    
-    /// 保存图片文件到指定目录, 如果目录已经存在会先删除老文件
-    /// - Parameters:
-    ///   - currentImage: 图片数据
-    ///   - persent: 质量
-    ///   - outFilePath: 输出目录
-    class func saveImage(currentImage: UIImage,outFilePath: String) {
-        // 文件存在先删除老文件
-        if FileManager.default.fileExists(atPath: outFilePath) {
-            do {
-                try FileManager.default.removeItem(at: NSURL.fileURL(withPath: outFilePath))
-            } catch {
-                BFLog(message: "删除文件出错 == \(error) \(outFilePath)")
-            }
-        }
-        
-        if let imageData = currentImage.pngData() {
-            try? imageData.write(to: URL(fileURLWithPath: outFilePath))
-            print("保存图片成功到:filePath=\(outFilePath)")
-        }
-    }
-}
-

+ 4 - 4
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -339,7 +339,7 @@ class PQStuckPointEditerController: PQBaseViewController {
     //
     lazy var speedStuckBtnGif: UIImageView = {
         let speedStuckBtnGif = UIImageView()
-        speedStuckBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "speedstuck_h", ofType: "gif")!))
+        speedStuckBtnGif.kf.setImage(with: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "speedstuck_h", ofType: "gif")!))
         speedStuckBtnGif.isHidden = true
         return speedStuckBtnGif
 
@@ -358,7 +358,7 @@ class PQStuckPointEditerController: PQBaseViewController {
 
     lazy var jumpPointBtnGif: UIImageView = {
         let jumpPointBtnGif = UIImageView()
-        jumpPointBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "jumpPoint_n", ofType: "gif")!))
+        jumpPointBtnGif.kf.setImage(with: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "jumpPoint_n", ofType: "gif")!))
         jumpPointBtnGif.isHidden = true
         return jumpPointBtnGif
 
@@ -689,8 +689,8 @@ class PQStuckPointEditerController: PQBaseViewController {
                 PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectPatternBgm, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
             }
         }
-        speedStuckBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: speedStuckBtnGifName, ofType: "gif")!))
-        jumpPointBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: jumpPointBtnGifName, ofType: "gif")!))
+        speedStuckBtnGif.kf.setImage(with: URL(fileURLWithPath: currentBundlePath()!.path(forResource: speedStuckBtnGifName, ofType: "gif")!))
+        jumpPointBtnGif.kf.setImage(with: URL(fileURLWithPath: currentBundlePath()!.path(forResource: jumpPointBtnGifName, ofType: "gif")!))
 
         speedStuckBtnGif.isHidden = false
         jumpPointBtnGif.isHidden = false

+ 3 - 3
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointPublicController.swift

@@ -290,7 +290,7 @@ class PQStuckPointPublicController: PQBaseViewController {
     // 手势提示
     lazy var pinView: UIImageView = {
         let pinView = UIImageView()
-        pinView.kf.setImage(with: URL(fileURLWithPath: (Bundle.current(moduleName: "BFFramework",isAssets: false)?.path(forResource: "editCoverPin", ofType: ".gif")!)!))
+        pinView.kf.setImage(with: URL(fileURLWithPath: (currentBundlePath()!.path(forResource: "editCoverPin", ofType: ".gif")!)))
         return pinView
     }()
 
@@ -1649,7 +1649,7 @@ extension PQStuckPointPublicController {
         var orgeBitRate = (editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) * (editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 3
         
         //片尾的视频素材地址
-        let moveResPath = Bundle().BF_mainbundle().path(forResource:  (editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) <  (editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) ? "endMovieB" : "endMovieA", ofType: "mp4")
+        let moveResPath = currentBundlePath()!.path(forResource:  (editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) <  (editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) ? "endMovieB" : "endMovieA", ofType: "mp4")
         if(moveResPath?.count ?? 0 == 0){
             BFLog(message: "片尾的视频素材地址无效!!!")
             return
@@ -1736,7 +1736,7 @@ extension PQStuckPointPublicController {
                    userNameSticker.materialPosition = userNamePostion
 
                    //4,音频
-                   let soundResPath = Bundle().BF_mainbundle().path(forResource: "endMovieSound", ofType: "mp3")
+                   let soundResPath = currentBundlePath()!.path(forResource: "endMovieSound", ofType: "mp3")
                    let soundAsset = AVURLAsset(url:  URL(fileURLWithPath: soundResPath ?? ""), options: nil)
                    self.endMovieExporter = PQCompositionExporter(asset: soundAsset, videoComposition: nil, audioMix: nil, filters: nil, stickers: [bgMovieInfo,avatarSticker,userNameSticker], animationTool: nil, exportURL: outPutMP4URL)
                    self.endMovieExporter.isEndMovie = true

+ 2 - 2
BFFramework/Classes/Stuckpoint/View/PQSelecteMusicView.swift

@@ -638,7 +638,7 @@ class PQSelectMusicCell: UICollectionViewCell {
             playImageView.isHidden = false
             imageMaskView.isHidden = false
             playImageView.image = nil
-            playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
+            playImageView.kf.setImage(with: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
       
         } else if  bgmData?.voiceStatue == .isPause{
             playImageView.isHidden = false
@@ -657,7 +657,7 @@ class PQSelectMusicCell: UICollectionViewCell {
 //            imageMaskView.isHidden = false
 //            if bgmData?.voiceStatue == .isPlaying {
 //                playImageView.image = nil
-//                playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
+//                playImageView.kf.setImage(with: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
 //
 //            } else {
 //                playImageView.image = UIImage().BF_Image(named: "stuckPoint_music_pause")

+ 2 - 2
BFFramework/Classes/Stuckpoint/View/PQStuckPointLoadingView.swift

@@ -16,7 +16,7 @@ class PQStuckPointLoadingView: UIView {
     lazy var loadingView: UIImageView = {
         let loadingView = UIImageView()
         loadingView.tintColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
-        let data = try? Data(contentsOf: URL(fileURLWithPath: (Bundle.current(moduleName: "BFFramework",isAssets: false)?.path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!)!))
+        let data = try? Data(contentsOf: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!))
         if data != nil {
             PQPHAssetVideoParaseUtil.parasGIFImage(data: data!, isRenderingColor: UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)) { _, images, duration in
                 loadingView.displayGIF(data: nil, images: images, repeatCount: .max, duration: duration ?? 2)
@@ -44,7 +44,7 @@ class PQStuckPointLoadingView: UIView {
         
     }
     func show() {
-        let data = try? Data(contentsOf: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!))
+        let data = try? Data(contentsOf: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!))
         if data != nil {
             PQPHAssetVideoParaseUtil.parasGIFImage(data: data!, isRenderingColor: UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)) { _, images, duration in
                 self.loadingView.displayGIF(data: nil, images: images, repeatCount: .max, duration: duration ?? 2)

+ 2 - 2
BFFramework/Classes/Stuckpoint/View/PQStuckPointMusicContentCell.swift

@@ -134,7 +134,7 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
                         playImageView.image = UIImage().BF_Image(named: "loading")
                         startLoadingAnimation()
                     }else {
-                        playImageView.kf.setImage(with: URL(fileURLWithPath: (Bundle.current(moduleName: "BFFramework",isAssets: false)?.path(forResource: "stuckPoint_music_playing", ofType: ".gif")!)!))
+                        playImageView.kf.setImage(with: URL(fileURLWithPath: (currentBundlePath()!.path(forResource: "stuckPoint_music_playing", ofType: ".gif")!)))
 
                     }
                     musicNameLab.move()
@@ -254,7 +254,7 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
     func stopLoadingAnimation(){
         playImageView.layer.removeAllAnimations()
         if (bgmData as? PQVoiceModel)?.isPlaying ?? false {
-            playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
+            playImageView.kf.setImage(with: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
         }
     }
 }

+ 19 - 0
BFFramework/Classes/Utils/PQCommonMethodUtil.swift

@@ -15,6 +15,7 @@ import KingfisherWebP
 import Photos
 import RealmSwift
 import Toast_Swift
+
 /// Home文件地址
 public let homeDirectory = NSHomeDirectory()
 /// docdocumens文件地址
@@ -821,3 +822,21 @@ public func zipImage(image: UIImage?, size: Int) -> Data? {
     }
     return data
 }
+
+
+func currentBundlePath() -> Bundle?{
+//    var associateBundleURL = Bundle.main.url(forResource: "Frameworks", withExtension: nil)
+//    associateBundleURL = associateBundleURL?.appendingPathComponent("BFFramework")
+//    associateBundleURL = associateBundleURL?.appendingPathExtension("framework")
+//
+//    if associateBundleURL == nil {
+//        print("获取bundle失败")
+//        return nil
+//    }
+//    let associateBunle = Bundle(url: associateBundleURL!)
+    let associateBundleURL = Bundle.main.url(forResource: "BFFramework", withExtension: "bundle")
+    if associateBundleURL == nil {
+        return nil
+    }
+    return Bundle(url: associateBundleURL!)
+}