├── .gitignore ├── JPush.podspec.json ├── LICENSE ├── README.md ├── lib ├── JPUSHService.h ├── libjcore-ios-1.0.0.a └── libjpush-ios-3.0.0.a └── publish.sh /.gitignore: -------------------------------------------------------------------------------- 1 | demo/ 2 | lib/ 3 | test/ -------------------------------------------------------------------------------- /JPush.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JPush", 3 | "version": "3.0.9", 4 | "summary": "Officially supported JPush iOS SDK Pod. 官方支持的极光推送SDK. ", 5 | "description": "Officially supported JPush iOS SDK Pod. 官方支持的极光推送SDK. \n集成详情请访问官方文档网站:https://docs.jiguang.cn ", 6 | "homepage": "https://www.jiguang.cn/", 7 | "license": { 8 | "type":"Copyright", 9 | "text":"Copyright jiguang.cn" 10 | }, 11 | "authors": { 12 | "JPush": "support@jpush.cn" 13 | }, 14 | "platforms": { 15 | "ios": "5.0" 16 | }, 17 | "source": { 18 | "http": "https://sdkfiledl.jiguang.cn/cocoapods/jpush/JPush-iOS-3.0.9.zip" 19 | }, 20 | "source_files": "*.h", 21 | "vendored_libraries": "*.a", 22 | "frameworks": [ 23 | "UIKit", 24 | "CFNetwork", 25 | "CoreFoundation", 26 | "CoreTelephony", 27 | "SystemConfiguration", 28 | "CoreGraphics", 29 | "Foundation", 30 | "Security" 31 | ], 32 | "weak_frameworks": [ 33 | "UserNotifications" 34 | ], 35 | "libraries": [ 36 | "z", 37 | "resolv" 38 | ], 39 | "dependencies": { 40 | "JCore": [ 41 | "~> 1.1.7" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 极光推送 JPush 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jpush-ios-sdk-pod 2 | ================= 3 | 4 | JPush's officially supported JPush iOS SDK Pod for CocoaPods. 极光推送官方支持的 iOS SDK Pod. 5 | -------------------------------------------------------------------------------- /lib/JPUSHService.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #define JPUSH_VERSION_NUMBER 3.0.0 13 | 14 | #import 15 | 16 | @class CLRegion; 17 | @class UILocalNotification; 18 | @class CLLocation; 19 | @class UNNotificationCategory; 20 | @class UNNotificationSettings; 21 | @class UNNotificationRequest; 22 | @class UNNotification; 23 | @protocol JPUSHRegisterDelegate; 24 | 25 | extern NSString *const kJPFNetworkIsConnectingNotification; // 正在连接中 26 | extern NSString *const kJPFNetworkDidSetupNotification; // 建立连接 27 | extern NSString *const kJPFNetworkDidCloseNotification; // 关闭连接 28 | extern NSString *const kJPFNetworkDidRegisterNotification; // 注册成功 29 | extern NSString *const kJPFNetworkFailedRegisterNotification; //注册失败 30 | extern NSString *const kJPFNetworkDidLoginNotification; // 登录成功 31 | extern NSString *const kJPFNetworkDidReceiveMessageNotification; // 收到消息(非APNS) 32 | extern NSString *const kJPFServiceErrorNotification; // 错误提示 33 | 34 | typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) { 35 | JPAuthorizationOptionNone = 0, // the application may not present any UI upon a notification being received 36 | JPAuthorizationOptionBadge = (1 << 0), // the application may badge its icon upon a notification being received 37 | JPAuthorizationOptionSound = (1 << 1), // the application may play a sound upon a notification being received 38 | JPAuthorizationOptionAlert = (1 << 2), // the application may display an alert upon a notification being received 39 | }; 40 | 41 | /*! 42 | * 通知注册实体类 43 | */ 44 | @interface JPUSHRegisterEntity : NSObject 45 | 46 | /*! 47 | * 支持的类型 48 | * badge,sound,alert 49 | */ 50 | @property (nonatomic, assign) NSInteger types; 51 | /*! 52 | * 注入的类别 53 | * iOS10 UNNotificationCategory 54 | * iOS8-iOS9 UIUserNotificationCategory 55 | */ 56 | @property (nonatomic, strong) NSSet *categories; 57 | @end 58 | 59 | /*! 60 | * 进行删除、查找推送实体类 61 | */ 62 | @interface JPushNotificationIdentifier : NSObject 63 | 64 | @property (nonatomic, copy) NSArray *identifiers; // 推送的标识数组 65 | @property (nonatomic, copy) UILocalNotification *notificationObj NS_DEPRECATED_IOS(4_0, 10_0); // iOS10以下可以传UILocalNotification对象数据,iOS10以上无效 66 | @property (nonatomic, assign) BOOL delivered NS_AVAILABLE_IOS(10_0); // 在通知中心显示的或待推送的标志,默认为NO,YES表示在通知中心显示的,NO表示待推送的 67 | @property (nonatomic, copy) void (^findCompletionHandler)(NSArray *results); // 用于查询回调,调用[findNotification:]方法前必须设置,results为返回相应对象数组,iOS10以下返回UILocalNotification对象数组;iOS10以上根据delivered传入值返回UNNotification或UNNotificationRequest对象数组(delivered传入YES,则返回UNNotification对象数组,否则返回UNNotificationRequest对象数组) 68 | 69 | @end 70 | 71 | /*! 72 | * 推送内容实体类 73 | */ 74 | @interface JPushNotificationContent : NSObject 75 | 76 | @property (nonatomic, copy) NSString *title; // 推送标题 77 | @property (nonatomic, copy) NSString *subtitle; // 推送副标题 78 | @property (nonatomic, copy) NSString *body; // 推送内容 79 | @property (nonatomic, copy) NSNumber *badge; // 角标的数字。如果不需要改变角标传@(-1) 80 | @property (nonatomic, copy) NSString *action NS_DEPRECATED_IOS(8_0, 10_0); // 弹框的按钮显示的内容(IOS 8默认为"打开", 其他默认为"启动",iOS10以上无效) 81 | @property (nonatomic, copy) NSString *categoryIdentifier; // 行为分类标识 82 | @property (nonatomic, copy) NSDictionary *userInfo; // 本地推送时可以设置userInfo来增加附加信息,远程推送时设置的payload推送内容作为此userInfo 83 | @property (nonatomic, copy) NSString *sound; // 声音名称,不设置则为默认声音 84 | @property (nonatomic, copy) NSArray *attachments NS_AVAILABLE_IOS(10_0); // 附件,iOS10以上有效,需要传入UNNotificationAttachment对象数组类型 85 | @property (nonatomic, copy) NSString *threadIdentifier NS_AVAILABLE_IOS(10_0); // 线程或与推送请求相关对话的标识,iOS10以上有效,可用来对推送进行分组 86 | @property (nonatomic, copy) NSString *launchImageName NS_AVAILABLE_IOS(10_0); // 启动图片名,iOS10以上有效,从推送启动时将会用到 87 | 88 | @end 89 | 90 | /*! 91 | * 推送触发方式实体类 92 | * 注:dateComponents、timeInterval、region在iOS10以上可选择其中一个参数传入有效值,如果同时传入值会根据优先级I、II、III使其中一种触发方式生效,fireDate为iOS10以下根据时间触发时须传入的参数 93 | */ 94 | @interface JPushNotificationTrigger : NSObject 95 | 96 | @property (nonatomic, assign) BOOL repeat; // 设置是否重复,默认为NO 97 | @property (nonatomic, copy) NSDate *fireDate NS_DEPRECATED_IOS(2_0, 10_0); // 用来设置触发推送的时间,iOS10以上无效 98 | @property (nonatomic, copy) CLRegion *region NS_AVAILABLE_IOS(8_0); // 用来设置触发推送的位置,iOS8以上有效,iOS10以上优先级为I,应用需要有允许使用定位的授权 99 | @property (nonatomic, copy) NSDateComponents *dateComponents NS_AVAILABLE_IOS(10_0); // 用来设置触发推送的日期时间,iOS10以上有效,优先级为II 100 | @property (nonatomic, assign) NSTimeInterval timeInterval NS_AVAILABLE_IOS(10_0); // 用来设置触发推送的时间,iOS10以上有效,优先级为III 101 | 102 | @end 103 | 104 | /*! 105 | * 注册或更新推送实体类 106 | */ 107 | @interface JPushNotificationRequest : NSObject 108 | 109 | @property (nonatomic, copy) NSString *requestIdentifier; // 推送请求标识 110 | @property (nonatomic, copy) JPushNotificationContent *content; // 设置推送的具体内容 111 | @property (nonatomic, copy) JPushNotificationTrigger *trigger; // 设置推送的触发方式 112 | @property (nonatomic, copy) void (^completionHandler)(id result); // 注册或更新推送成功回调,iOS10以上成功则result为UNNotificationRequest对象,失败则result为nil;iOS10以下成功result为UILocalNotification对象,失败则result为nil 113 | 114 | @end 115 | 116 | /*! 117 | * JPush 核心头文件 118 | */ 119 | @interface JPUSHService : NSObject 120 | 121 | 122 | ///---------------------------------------------------- 123 | /// @name Setup 启动相关 124 | ///---------------------------------------------------- 125 | 126 | /*! 127 | * @abstract 启动SDK 128 | * 129 | * @discussion 这是旧版本的启动方法, 依赖于 PushConfig.plist 文件. 建议不要使用, 已经过期. 130 | */ 131 | + (void)setupWithOption:(NSDictionary *)launchingOption __attribute__((deprecated("JPush 2.1.0 版本已过期"))); 132 | 133 | /*! 134 | * @abstract 启动SDK 135 | * 136 | * @param launchingOption 启动参数. 137 | * @param appKey 一个JPush 应用必须的,唯一的标识. 请参考 JPush 相关说明文档来获取这个标识. 138 | * @param channel 发布渠道. 可选. 139 | * @param isProduction 是否生产环境. 如果为开发状态,设置为 NO; 如果为生产状态,应改为 YES. 140 | * @param advertisingIdentifier 广告标识符(IDFA) 如果不需要使用IDFA,传nil. 141 | * 142 | * @discussion 提供SDK启动必须的参数, 来启动 SDK. 143 | * 此接口必须在 App 启动时调用, 否则 JPush SDK 将无法正常工作. 144 | */ 145 | + (void)setupWithOption:(NSDictionary *)launchingOption 146 | appKey:(NSString *)appKey 147 | channel:(NSString *)channel 148 | apsForProduction:(BOOL)isProduction; 149 | 150 | 151 | + (void)setupWithOption:(NSDictionary *)launchingOption 152 | appKey:(NSString *)appKey 153 | channel:(NSString *)channel 154 | apsForProduction:(BOOL)isProduction 155 | advertisingIdentifier:(NSString *)advertisingId; 156 | 157 | 158 | ///---------------------------------------------------- 159 | /// @name APNs about 通知相关 160 | ///---------------------------------------------------- 161 | 162 | /*! 163 | * @abstract 注册要处理的远程通知类型 164 | * 165 | * @param types 通知类型 166 | * @param categories 类别组 167 | * 168 | */ 169 | + (void)registerForRemoteNotificationTypes:(NSUInteger)types 170 | categories:(NSSet *)categories; 171 | /*! 172 | * @abstract 新版本的注册方法(兼容iOS10) 173 | * 174 | * @param config 注册通知配置 175 | * @param delegate 代理 176 | * 177 | */ 178 | + (void)registerForRemoteNotificationConfig:(JPUSHRegisterEntity *)config delegate:(id)delegate; 179 | 180 | 181 | + (void)registerDeviceToken:(NSData *)deviceToken; 182 | 183 | 184 | /*! 185 | * @abstract 处理收到的 APNs 消息 186 | */ 187 | + (void)handleRemoteNotification:(NSDictionary *)remoteInfo; 188 | 189 | 190 | ///---------------------------------------------------- 191 | /// @name Tag alias setting 设置别名与标签 192 | ///---------------------------------------------------- 193 | 194 | /*! 195 | * 下面的接口是可选的 196 | * 设置标签和(或)别名(若参数为nil,则忽略;若是空对象,则清空;详情请参考文档:https://docs.jiguang.cn/jpush/client/iOS/ios_api/) 197 | * setTags:alias:fetchCompletionHandle:是新的设置标签别名的方法,不再需要显示声明回调函数,只需要在block里面处理设置结果即可. 198 | * WARN: 使用block时需要注意循环引用问题 199 | */ 200 | + (void) setTags:(NSSet *)tags 201 | alias:(NSString *)alias 202 | callbackSelector:(SEL)cbSelector 203 | target:(id)theTarget __attribute__((deprecated("JPush 2.1.1 版本已过期"))); 204 | 205 | + (void) setTags:(NSSet *)tags 206 | alias:(NSString *)alias 207 | callbackSelector:(SEL)cbSelector 208 | object:(id)theTarget; 209 | 210 | + (void) setTags:(NSSet *)tags 211 | callbackSelector:(SEL)cbSelector 212 | object:(id)theTarget; 213 | 214 | + (void)setTags:(NSSet *)tags 215 | alias:(NSString *)alias 216 | fetchCompletionHandle:(void (^)(int iResCode, NSSet *iTags, NSString *iAlias))completionHandler; 217 | 218 | + (void) setTags:(NSSet *)tags 219 | aliasInbackground:(NSString *)alias; 220 | 221 | + (void)setAlias:(NSString *)alias 222 | callbackSelector:(SEL)cbSelector 223 | object:(id)theTarget; 224 | 225 | /*! 226 | * @abstract 过滤掉无效的 tags 227 | * 228 | * @discussion 如果 tags 数量超过限制数量, 则返回靠前的有效的 tags. 229 | * 建议设置 tags 前用此接口校验. SDK 内部也会基于此接口来做过滤. 230 | */ 231 | + (NSSet *)filterValidTags:(NSSet *)tags; 232 | 233 | 234 | ///---------------------------------------------------- 235 | /// @name Stats 统计功能 236 | ///---------------------------------------------------- 237 | 238 | /*! 239 | * @abstract 开始记录页面停留 240 | * 241 | * @param pageName 页面名称 242 | */ 243 | + (void)startLogPageView:(NSString *)pageName; 244 | 245 | /*! 246 | * @abstract 停止记录页面停留 247 | * 248 | * @param pageName 页面 249 | */ 250 | + (void)stopLogPageView:(NSString *)pageName; 251 | 252 | /*! 253 | * @abstract 直接上报在页面的停留时间 254 | * 255 | * @param pageName 页面 256 | * @param seconds 停留的秒数 257 | */ 258 | + (void)beginLogPageView:(NSString *)pageName duration:(int)seconds; 259 | 260 | /*! 261 | * @abstract 开启Crash日志收集 262 | * 263 | * @discussion 默认是关闭状态. 264 | */ 265 | + (void)crashLogON; 266 | 267 | /*! 268 | * @abstract 地理位置上报 269 | * 270 | * @param latitude 纬度. 271 | * @param longitude 经度. 272 | * 273 | */ 274 | + (void)setLatitude:(double)latitude longitude:(double)longitude; 275 | 276 | /*! 277 | * @abstract 地理位置上报 278 | * 279 | * @param location 直接传递 CLLocation * 型的地理信息 280 | * 281 | * @discussion 需要链接 CoreLocation.framework 并且 #import 282 | */ 283 | + (void)setLocation:(CLLocation *)location; 284 | 285 | 286 | ///---------------------------------------------------- 287 | /// @name Local Notification 本地通知 288 | ///---------------------------------------------------- 289 | /*! 290 | * @abstract 注册或更新推送 (支持iOS10,并兼容iOS10以下版本) 291 | * 292 | * JPush 2.1.9新接口 293 | * @param request JPushNotificationRequest类型,设置推送的属性,设置已有推送的request.requestIdentifier即更新已有的推送,否则为注册新推送,更新推送仅仅在iOS10以上有效,结果通过request.completionHandler返回 294 | * @discussion 旧的注册本地推送接口被废弃,使用此接口可以替换 295 | * 296 | */ 297 | + (void)addNotification:(JPushNotificationRequest *)request; 298 | 299 | /*! 300 | * @abstract 移除推送 (支持iOS10,并兼容iOS10以下版本) 301 | * 302 | * JPush 2.1.9新接口 303 | * @param identifier JPushNotificationIdentifier类型,iOS10以上identifier设置为nil,则移除所有在通知中心显示推送和待推送请求,也可以通过设置identifier.delivered和identifier.identifiers来移除相应在通知中心显示推送或待推送请求,identifier.identifiers如果设置为nil或空数组则移除相应标志下所有在通知中心显示推送或待推送请求;iOS10以下identifier设置为nil,则移除所有推送,identifier.delivered属性无效,另外可以通过identifier.notificationObj传入特定推送对象来移除此推送。 304 | * @discussion 旧的所有删除推送接口被废弃,使用此接口可以替换 305 | * 306 | */ 307 | + (void)removeNotification:(JPushNotificationIdentifier *)identifier; 308 | 309 | /*! 310 | * @abstract 查找推送 (支持iOS10,并兼容iOS10以下版本) 311 | * 312 | * JPush 2.1.9新接口 313 | * @param identifier JPushNotificationIdentifier类型,iOS10以上可以通过设置identifier.delivered和identifier.identifiers来查找相应在通知中心显示推送或待推送请求,identifier.identifiers如果设置为nil或空数组则返回相应标志下所有在通知中心显示推送或待推送请求;iOS10以下identifier.delivered属性无效,identifier.identifiers如果设置nil或空数组则返回所有推送。须要设置identifier.findCompletionHandler回调才能得到查找结果,通过(NSArray *results)返回相应对象数组。 314 | * @discussion 旧的查找推送接口被废弃,使用此接口可以替换 315 | * 316 | */ 317 | + (void)findNotification:(JPushNotificationIdentifier *)identifier; 318 | 319 | /*! 320 | * @abstract 本地推送,最多支持64个 321 | * 322 | * @param fireDate 本地推送触发的时间 323 | * @param alertBody 本地推送需要显示的内容 324 | * @param badge 角标的数字。如果不需要改变角标传-1 325 | * @param alertAction 弹框的按钮显示的内容(IOS 8默认为"打开", 其他默认为"启动") 326 | * @param notificationKey 本地推送标示符 327 | * @param userInfo 自定义参数,可以用来标识推送和增加附加信息 328 | * @param soundName 自定义通知声音,设置为nil为默认声音 329 | * 330 | * @discussion 最多支持 64 个定义,此方法被[addNotification:]方法取代 331 | */ 332 | + (UILocalNotification *)setLocalNotification:(NSDate *)fireDate 333 | alertBody:(NSString *)alertBody 334 | badge:(int)badge 335 | alertAction:(NSString *)alertAction 336 | identifierKey:(NSString *)notificationKey 337 | userInfo:(NSDictionary *)userInfo 338 | soundName:(NSString *)soundName __attribute__((deprecated("JPush 2.1.9 版本已过期"))); 339 | 340 | /*! 341 | * @abstract 本地推送 (支持 iOS8 新参数) 342 | * 343 | * IOS8新参数 344 | * @param region 自定义参数 345 | * @param regionTriggersOnce 自定义参数 346 | * @param category 自定义参数 347 | * @discussion 此方法被[addNotification:]方法取代 348 | */ 349 | + (UILocalNotification *)setLocalNotification:(NSDate *)fireDate 350 | alertBody:(NSString *)alertBody 351 | badge:(int)badge 352 | alertAction:(NSString *)alertAction 353 | identifierKey:(NSString *)notificationKey 354 | userInfo:(NSDictionary *)userInfo 355 | soundName:(NSString *)soundName 356 | region:(CLRegion *)region 357 | regionTriggersOnce:(BOOL)regionTriggersOnce 358 | category:(NSString *)category NS_AVAILABLE_IOS(8_0) __attribute__((deprecated("JPush 2.1.9 版本已过期"))); 359 | 360 | /*! 361 | * @abstract 前台展示本地推送 362 | * 363 | * @param notification 本地推送对象 364 | * @param notificationKey 需要前台显示的本地推送通知的标示符 365 | * 366 | * @discussion 默认App在前台运行时不会进行弹窗,在程序接收通知调用此接口可实现指定的推送弹窗。--iOS10以下还可继续使用,iOS10以上在[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:]方法中调用completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);即可 367 | */ 368 | + (void)showLocalNotificationAtFront:(UILocalNotification *)notification 369 | identifierKey:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期"))); 370 | /*! 371 | * @abstract 删除本地推送定义 372 | * 373 | * @param notificationKey 本地推送标示符 374 | * @discussion 此方法被[removeNotification:]方法取代 375 | */ 376 | + (void)deleteLocalNotificationWithIdentifierKey:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期"))); 377 | 378 | /*! 379 | * @abstract 删除本地推送定义 380 | * @discussion 此方法被[removeNotification:]方法取代 381 | */ 382 | + (void)deleteLocalNotification:(UILocalNotification *)localNotification __attribute__((deprecated("JPush 2.1.9 版本已过期"))); 383 | 384 | /*! 385 | * @abstract 获取指定通知 386 | * 387 | * @param notificationKey 本地推送标示符 388 | * @return 本地推送对象数组, [array count]为0时表示没找到 389 | * @discussion 此方法被[findNotification:]方法取代 390 | */ 391 | + (NSArray *)findLocalNotificationWithIdentifier:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期"))); 392 | 393 | /*! 394 | * @abstract 清除所有本地推送对象 395 | * @discussion 此方法被[removeNotification:]方法取代 396 | */ 397 | + (void)clearAllLocalNotifications __attribute__((deprecated("JPush 2.1.9 版本已过期"))); 398 | 399 | 400 | ///---------------------------------------------------- 401 | /// @name Server badge 服务器端 badge 功能 402 | ///---------------------------------------------------- 403 | 404 | /*! 405 | * @abstract 设置角标(到服务器) 406 | * 407 | * @param value 新的值. 会覆盖服务器上保存的值(这个用户) 408 | * 409 | * @discussion 本接口不会改变应用本地的角标值. 410 | * 本地仍须调用 UIApplication:setApplicationIconBadgeNumber 函数来设置脚标. 411 | * 412 | * 本接口用于配合 JPush 提供的服务器端角标功能. 413 | * 该功能解决的问题是, 服务器端推送 APNs 时, 并不知道客户端原来已经存在的角标是多少, 指定一个固定的数字不太合理. 414 | * 415 | * JPush 服务器端脚标功能提供: 416 | * 417 | * - 通过本 API 把当前客户端(当前这个用户的) 的实际 badge 设置到服务器端保存起来; 418 | * - 调用服务器端 API 发 APNs 时(通常这个调用是批量针对大量用户), 419 | * 使用 "+1" 的语义, 来表达需要基于目标用户实际的 badge 值(保存的) +1 来下发通知时带上新的 badge 值; 420 | */ 421 | + (BOOL)setBadge:(NSInteger)value; 422 | 423 | /*! 424 | * @abstract 重置脚标(为0) 425 | * 426 | * @discussion 相当于 [setBadge:0] 的效果. 427 | * 参考 [JPUSHService setBadge:] 说明来理解其作用. 428 | */ 429 | + (void)resetBadge; 430 | 431 | 432 | ///---------------------------------------------------- 433 | /// @name Logs and others 日志与其他 434 | ///---------------------------------------------------- 435 | 436 | /*! 437 | * @abstract JPush标识此设备的 registrationID 438 | * 439 | * @discussion SDK注册成功后, 调用此接口获取到 registrationID 才能够获取到. 440 | * 441 | * JPush 支持根据 registrationID 来进行推送. 442 | * 如果你需要此功能, 应该通过此接口获取到 registrationID 后, 上报到你自己的服务器端, 并保存下来. 443 | * registrationIDCompletionHandler:是新增的获取registrationID的方法,需要在block中获取registrationID,resCode为返回码,模拟器调用此接口resCode返回1011,registrationID返回nil. 444 | * 更多的理解请参考 JPush 的文档网站. 445 | */ 446 | + (NSString *)registrationID; 447 | 448 | + (void)registrationIDCompletionHandler:(void(^)(int resCode,NSString *registrationID))completionHandler; 449 | 450 | /*! 451 | * @abstract 打开日志级别到 Debug 452 | * 453 | * @discussion JMessage iOS 的日志系统参考 Android 设计了级别. 454 | * 从低到高是: Verbose, Debug, Info, Warning, Error. 455 | * 对日志级别的进一步理解, 请参考 Android 相关的说明. 456 | * 457 | * SDK 默认开启的日志级别为: Info. 只显示必要的信息, 不打印调试日志. 458 | * 459 | * 调用本接口可打开日志级别为: Debug, 打印调试日志. 460 | */ 461 | + (void)setDebugMode; 462 | 463 | /*! 464 | * @abstract 关闭日志 465 | * 466 | * @discussion 关于日志级别的说明, 参考 [JPUSHService setDebugMode] 467 | * 468 | * 虽说是关闭日志, 但还是会打印 Warning, Error 日志. 这二种日志级别, 在程序运行正常时, 不应有打印输出. 469 | * 470 | * 建议在发布的版本里, 调用此接口, 关闭掉日志打印. 471 | */ 472 | + (void)setLogOFF; 473 | 474 | @end 475 | 476 | @class UNUserNotificationCenter; 477 | @class UNNotificationResponse; 478 | 479 | @protocol JPUSHRegisterDelegate 480 | 481 | /* 482 | * @brief handle UserNotifications.framework [willPresentNotification:withCompletionHandler:] 483 | * @param center [UNUserNotificationCenter currentNotificationCenter] 新特性用户通知中心 484 | * @param notification 前台得到的的通知对象 485 | * @param completionHandler 该callback中的options 请使用UNNotificationPresentationOptions 486 | */ 487 | - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger options))completionHandler; 488 | /* 489 | * @brief handle UserNotifications.framework [didReceiveNotificationResponse:withCompletionHandler:] 490 | * @param center [UNUserNotificationCenter currentNotificationCenter] 新特性用户通知中心 491 | * @param response 通知响应对象 492 | * @param completionHandler 493 | */ 494 | - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler; 495 | 496 | @end 497 | -------------------------------------------------------------------------------- /lib/libjcore-ios-1.0.0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jpush-ios-sdk-pod/24a1f7e36cfb6e9a17845825dd51f2e40bac505f/lib/libjcore-ios-1.0.0.a -------------------------------------------------------------------------------- /lib/libjpush-ios-3.0.0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jpush-ios-sdk-pod/24a1f7e36cfb6e9a17845825dd51f2e40bac505f/lib/libjpush-ios-3.0.0.a -------------------------------------------------------------------------------- /publish.sh: -------------------------------------------------------------------------------- 1 | # if 2>1; then 2 | # #statements 3 | # echo "dsafaf"; 4 | # fi 5 | 6 | while [[ true ]]; do 7 | #statements 8 | pod trunk push --allow-warnings; 9 | done 10 | --------------------------------------------------------------------------------