iOS 消息推送 SDK 開發包:aerogear-ios-push

jopen 9年前發布 | 17K 次閱讀 iOS開發 移動開發 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.baiduhome.net/lib/view/home/1422068547765

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!