Swift:println() 没有在“查看设备日志"中显示任何内容;在“设备"中标签 [英] Swift : println() doesn't show anything into "View Device Logs" in "Devices" tab

查看:22
本文介绍了Swift:println() 没有在“查看设备日志"中显示任何内容;在“设备"中标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发应用程序,当应用程序使用 AdHoc 配置文件运行时,我需要在其中获取设备令牌.因为我无法使用 AdHoc 配置文件进行调试.我需要查看使用 println() 打印设备令牌的登录信息.但是,我没有展示任何东西.

I am developing the application into which I need to get devicetoken when app is running with AdHoc profile. Because I am not able to debug with AdHoc profile. I need to see log into which I print device token with println(). But, I doesn't show anything into it.

推荐答案

最后,我得到了解决方案.我们也可以使用 NSLog() 进入 swift 代码.所以,我们想在那里打印日志,你使用 NSLog() 函数.例子,

Finally, I got solution for it. We can also user NSLog() into swift code. so, where we want to print log there you use NSLog() function. Example ,

 func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
        var deviceTokenOrigin = deviceToken.description.stringByTrimmingCharactersInSet(NSCharacterSet(charactersInString: "<>"))
        var deviceTokenFiltered = deviceTokenOrigin.stringByReplacingOccurrencesOfString(" ", withString: "")
        self.deviceTocken = deviceTokenFiltered
        NSLog("DeviceToken : %@", deviceTokenFiltered)
    }

这篇关于Swift:println() 没有在“查看设备日志"中显示任何内容;在“设备"中标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆