iOS 消息推送 SDK 开发包:aerogear-ios-push

分享到:

aerogear-ios-push 是为 AeroGear UnifiedPush Server 提供的 iOS 消息推送 SDK 开发包。UnifiedPush Server 是 AeroGear 的一个移动应用的消息推送服务器端开源项目。初始版本支持 Apple’s APNs, Google Cloud MessagingMozilla Simple Push.

示例代码:

  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)")
})
}

项目主页:http://www.open-open.com/lib/view/home/1422068547765

昵    称:
验证码:

相关文档: