使用CDESetLogCallback转发Ensembles日志

时间:2015-08-09 18:11:21

标签: ios swift ensembles

我正在尝试将Ensembles记录转发到我的记录器类。 但是我在第一次调用CDELog

时获得了EXC_BAD_ACCESS

设置CDESetLogCallback的代码:

    lazy var opaquePointerLogFunc : COpaquePointer = {
                let mutablePointer = UnsafeMutablePointer<(String,CVarArgType...) -> Void>.alloc(1)
                mutablePointer.initialize(myLog)
                let opaquePointer = COpaquePointer(mutablePointer)
                return opaquePointer
            }()


    func myLog(message:String, args : CVarArgType ...){
            println(__FUNCTION__)
            //never gets called
        }

    CDESetLogCallback(self.opaquePointerLogFunc)

0 个答案:

没有答案