How can I convert my device token (NSData) into an NSString?

后端 未结 30 1930
挽巷
挽巷 2020-11-28 18:31

I am implementing push notifications. I\'d like to save my APNS Token as a String.

- (void)application:(UIApplication *)application
didRegisterForRemoteNotif         


        
30条回答
  •  失恋的感觉
    2020-11-28 19:13

    Try this one unless the data is null-terminated.

    NSString* newStr = [[NSString alloc] initWithData:newDeviceToken encoding:NSUTF8StringEncoding];

提交回复
热议问题