我正在尝试使用下面的代码检索deviceToken:
func application(application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let installation = PFInstallation.currentInstallation()
installation.setDeviceTokenFromData(deviceToken)
installation.saveInBackground()
let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)
var tokenString = ""
for var i = 0; i < deviceToken.length; i++ {
tokenString += String(format: "%02.2hhx", arguments: [tokenChars[i]])
}
self.deviceToken = "\(tokenString)"
println("\(tokenString)")
var s = tokenString.hmac(CryptoAlgorithm.MD5, key: "")
}我注意到一些设备没有执行此方法。这一切为什么要发生?如何使用不同的方法获取deviceToken?
发布于 2015-07-21 02:12:27
要获取设备推送令牌,您的应用程序必须支持推送通知,这将通过在成员中心注册用于该应用程序的应用程序id并在xcode中使用与该应用程序相同的应用程序id的配置文件来确保
https://stackoverflow.com/questions/31522933
复制相似问题