How to present apns token in view controller? [duplicate]
问题 This question already has answers here : How can I convert my device token (NSData) into an NSString? (28 answers) Closed 2 years ago . I don't understand how to present the apns token as a string in view-controller. tried a lot of things and nothings worked out. in swift 4. 回答1: 1. You can save it to UserDefaults as Halil suggested like so: UserDefaults.standard.set(yourAPNSToken, forKey: "APNSToken") And retrieve it inside your ViewController: let token = UserDefaults.standard.string(forKey