CMPushNotificationService
示例
要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install
。
要求
安装
CMPushNotificationService 可在 CocoaPods 中使用。要安装它,只需将以下行添加到 Podfile 中
pod 'CMPushNotificationService'
许可证
CMPushNotificationService 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。
使用方法
-
创建一个遵循CMPushNotificationHandler协议的NSOjbect类(例如:CMPushManager,以下都使用这个类)
-
在didFinishLaunchingWithOptions中注册推送服务
JPushConfig *config = [JPushConfig configWithAppKey:@"" channel:@"" apsForProduction:YES isDebug:YES]; [[CMPushNotificationService sharedManager] configurePushWithLaunchOptions:launchOptions pushConfig:config pushNotificationHandler:[CMPushManager new]];
- 在需要的位置注册推送
[[CMPushNotificationService sharedManager] registerRemoteNotification];
- 在视图加载完成的地方开始推送
[[CMPushNotificationService sharedManager] applicationDidLoad];
-
在CMPushManager.m中实现协议方法即可
-
具体使用方法可参考Example