我正在尝试转换设备令牌并使用以下代码(swift 3):
parameters["device_token"] = request.deviceToken.reduce("", {$0 + String(format: "%02X", $1)}). 
但是我收到了编译器错误Binary operator '+' cannot be applied to operands of type Any? and String.我在这做错了什么?
试试这个
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
var token = ""
for i in 0..<deviceToken.count {
 token = token + String(format: "%02.2hhx", arguments: [deviceToken[i]])
  }
  print("Registration succeeded!")
  print("Token: ", token)
 }
| 归档时间: | 
 | 
| 查看次数: | 789 次 | 
| 最近记录: |