简体   繁体   中英

Device token is nil, when I download the app from testflight..?

我从 testflight 下载应用程序然后我尝试登录我得到设备令牌 nil .. 请给我解决方案。

What function are you using to get the device token? You are probably making a small mistake. Copy-pasting your code helps.

in your appDelegate, you should have something like this,

// Called when APNs has assigned the device a unique token

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    // Convert token to string
    let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})

    // Print it to console
    print("APNs device token: \(deviceTokenString)")

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM