aerogear-ios-push
- 授权协议: Apache
- 开发语言: Swift
- 操作系统: iOS
- 软件首页: https://github.com/aerogear/aerogear-ios-push
- 软件文档: https://github.com/aerogear/aerogear-ios-push
软件介绍
aerogear-ios-push 是为 AeroGear UnifiedPush Server 提供的 iOS 消息推送 SDK 开发包。
示例代码:
func application(application: UIApplication!, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData!) {
// setup registration
let registration = AGDeviceRegistration(serverURL: NSURL(string: "<# URL of the running AeroGear UnifiedPush Server #>")!)
// attemp to register
registration.registerWithClientInfo({ (clientInfo: AGClientDeviceInformation!) in
// setup configuration
clientInfo.deviceToken = deviceToken
clientInfo.variantID = "<# Variant Id #>"
clientInfo.variantSecret = "<# Variant Secret #>"
// apply the token, to identify THIS device
let currentDevice = UIDevice()
// --optional config--
// set some 'useful' hardware information params
clientInfo.operatingSystem = currentDevice.systemName
clientInfo.osVersion = currentDevice.systemVersion
clientInfo.deviceType = currentDevice.model
},
success: {
println("UnifiedPush Server registration succeeded")
},
failure: {(error: NSError!) in
println("failed to register, error: \(error.description)")
})
}
