Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift : println() doesn't show anything into "View Device Logs" in "Devices" tab

Tags:

xcode

ios

swift

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.

like image 969
girish_pro Avatar asked Dec 24 '22 17:12

girish_pro


1 Answers

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)
    }
like image 110
girish_pro Avatar answered Jan 31 '23 13:01

girish_pro