调试 0.2.1

调试 0.2.1

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布最新发布2016 年 8 月
SPM支持 SPM

Matteo Crippa 维护。



调试 0.2.1

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录中运行 pod install

故障排除

如果您处于调试模式且没有显示日志,请在您的 Swift 编译器 - 自定义标志 - 其他标志 中设置,仅限 DEBUG,一个像 -DDEBUG 这样的标志

用法

使用以下方式导入库

import Debug

然后,使用 print 函数正常使用,但像这样在其前加上 Debug

Debug.print('Hello world!')

调试还支持远程日志,克隆 Debug-Remote 并启动服务器。

然后,在您的 AppDelegate 中添加这个简单(额外行)

Debug.set(remoteURI: "http://")

根据服务器提供的设置您的远程日志 URL。

重要 每次您重启服务器时,您将得到一个新的 URL,请注意在上次重新启动服务器之前更新您的 URL。

然后更新您的 Info.plist 文件,添加以下条目

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localtunnel.me</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>

安装

调试通过 CocoaPods 提供。要安装它,只需在您的 Podfile 中添加以下行

pod "Debug"

然后在 end 之后添加以下几行来管理 DEBUG 标志

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'Debug'
            target.build_configurations.each do |config|
                if config.name == 'Debug'
                    config.build_settings['OTHER_SWIFT_FLAGS'] = '-DDEBUG'
                else
                    config.build_settings['OTHER_SWIFT_FLAGS'] = ''
                end
            end
        end
    end
end

作者

Matteo Crippa,@ghego20

许可

调试受 MIT 许可证保护。有关更多信息,请参阅 LICENSE 文件。