Swift: println () shows nothing in "View device logs" under "Devices" tab

I am developing an application where I need to get a devicetoken when the application is running with an AdHoc profile. Because I cannot debug the AdHoc profile. I need to see the log that I am printing the device token to using println (). But I am not showing anything in this.

+3


source to share


1 answer


Finally I got a solution for this. We can also use NSLog () for quick code. so where we want to print the log you use the 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)
    }

      

+9


source







All Articles