AfterPushSDK 0.1.0

AfterPushSDK 0.1.0

测试已测试
语言语言 Obj-CObjective C
许可证 自定义
发布最后发布2015 年 4 月

AfterPush 维护。



AfterPush iOS SDK

AfterPush 提供

当前 SDK 版本:v1.0

介绍

AfterPush是为所有 iOS 和 Android 开发者提供推送通知服务。

特性

  • 轻量级推送通知库。
  • 与 iTunes Store 集成的 App 版本控制。
  • 通过 CocoaPods 在 Xcode 中轻松实现。
  • 现场支持和快速更新!
  • 使用我们的 AfterPush 应用随时随地推送通知。
  • 第一次,无需实现我们的 SDK 即可尝试推送通知。

变更日志

版本 1.0

  • AfterPush 第一版发布
  • 远程推送通知
  • 与 iTunes Store 同步的 App 版本控制。

安装

1) 从 Apple 开发者那里获取 p12

遵循此指南为沙盒和生产环境创建证书,别忘了在您的应用 ID 上启用推送通知。

沙盒

  • 导出您的证书 p12 并将其保存为 apns-dev-cert.p12
  • 导出您的私钥 p12 并将其保存为 apns-dev-key.12

生产

  • 导出您的证书 p12 并将其保存为 apns-pro-cert.p12
  • 导出您的私钥 p12 并将其保存为 apns-pro-key.12

2) 将 p12 转换为 PEM 格式

沙盒
    openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
    openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
    openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
    cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem
生产
    openssl pkcs12 -clcerts -nokeys -out apns-pro-cert.pem -in apns-pro-cert.p12
    openssl pkcs12 -nocerts -out apns-pro-key.pem -in apns-pro-key.p12
    openssl rsa -in apns-pro-key.pem -out apns-pro-key-noenc.pem
    cat apns-pro-cert.pem apns-pro-key-noenc.pem > apns-pro.pem

3) 在 AfterPush 上注册账户

4) 创建您的应用并上传 pem 文件。

alt text

5) 获取您的应用密钥

alt text

6) 实现 SDK

  • 将其添加到 Podfile 文件。

    Pod 'AfterPushSDK', '~>0.0.8'

  • 下载 AfterPushSDK.hlibAfterPushSDK.a 并将其添加到您的项目中,包括两个框架:CoreLocation.framework CoreTelephony.framework

7) 修改您的 AppDelegate.m

导航到项目中 AppDelegate.m 并包含
    #import "AfterPushSDK.h"
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.

        [[AfterPushSDK sharedInstance] initWithAppKey:@"YOUR_APP_KEY"];
        #ifdef __IPHONE_8_0
        //Right, that is the point
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
                                                                                             |UIRemoteNotificationTypeSound
                                                                                             |UIRemoteNotificationTypeAlert) categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
        #else
        //register to receive notifications
        UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert |UIRemoteNotificationTypeSound;
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];
        #endif
    }
    - (void)application:(UIApplication *)application
    didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        [[AfterPushSDK sharedInstance] registerDeviceToken:deviceToken];
    }
    - (void)application:(UIApplication *)application
    didReceiveRemoteNotification:(NSDictionary *)userInfo {
        [[AfterPushSDK sharedInstance] notificationHandler:userInfo];
    }

支持

如SDK有任何问题,请将您的反馈发送至邮箱[email protected],这对我们非常重要。