1, 需要用桥接文件 , 不然引用不到依赖库
2, 可以用测试模式测试, 可以debug
3, 测试模式获取deviceToken, 添加测试设备
deviceToken获取方法文章来源:https://www.toymoban.com/news/detail-656758.html
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let device = NSData.init(data: deviceToken)文章来源地址https://www.toymoban.com/news/detail-656758.html
var deviceId = String()
if #available(iOS 13.0, *) {
let bytes = [UInt8](deviceToken)
for item in bytes {
deviceId += String(format: "%02x", item&0x000000FF)
}
print("iOS 13 deviceToken:\(deviceId)")
} else {
let device = NSData(data: deviceToken)
deviceId = device.description.replacingOccurrences(of:"<", with:"").replacingOccurrences(of:">", with:"").replacingOccurrences(of: " ", with:"")
print("我的deviceToken:\(deviceId)")
}
}
到了这里,关于swift 项目集成友盟推送的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!