diff --git a/doc/iOS_API.md b/doc/iOS_API.md
index 3ef7e10..4f5c6d9 100644
--- a/doc/iOS_API.md
+++ b/doc/iOS_API.md
@@ -10,12 +10,14 @@
- [获取自定义消息内容](#获取自定义消息内容)
- [设置Badge](#设置badge)
- [本地通知](#本地通知)
+- [获取本地通知内容](#获取本地通知内容)
- [页面的统计](#页面的统计)
- [日志等级设置](#日志等级设置)
- [地理位置上报](#地理位置上报)
- [设备平台判断](#设备平台判断)
- [iOS 10 进阶推送特性](#ios-10-进阶推送特性)
- [获取用户推送设置](#获取用户推送设置)
+- [监听事件统一说明](#监听事件统一说明)
## 开始与停止推送服务
@@ -35,7 +37,9 @@ JPush SDK 会恢复正常的默认行为。(因为保存在本地的状态数
#### 接口定义
- window.plugins.jPushPlugin.init()
+```
+window.plugins.jPushPlugin.init()
+```
### API - stopPush
@@ -52,7 +56,10 @@ JPush SDK 会恢复正常的默认行为。(因为保存在本地的状态数
#### 接口定义
- window.plugins.jPushPlugin.resumePush()
+```
+window.plugins.jPushPlugin.resumePush()
+```
+
### API - isPushStopped
@@ -61,7 +68,9 @@ iOS平台,检查推送服务是否停止。
#### 接口定义
- window.plugins.jPushPlugin.isPushStopped(callback)
+```
+window.plugins.jPushPlugin.isPushStopped(callback)
+```
#### 参数说明
@@ -69,13 +78,15 @@ iOS平台,检查推送服务是否停止。
#### 代码示例
- window.plugins.jPushPlugin.isPushStopped(function(data) {
- if(data > 0) {
- // 已关闭
- } else {
- // 已开启
- }
- })
+```js
+window.plugins.jPushPlugin.isPushStopped(function(data) {
+ if(data > 0) {
+ // 已关闭
+ } else {
+ // 已开启
+ }
+ })
+```
## 获取 RegistrationID
@@ -90,7 +101,9 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
#### 接口定义
- JPushPlugin.prototype.getRegistrationID(callback)
+```js
+JPushPlugin.prototype.getRegistrationID(callback)
+```
#### 返回值
@@ -98,9 +111,13 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
#### 调用示例
- window.plugins.jPushPlugin.getRegistrationID(function(data) {
- console.log("JPushPlugin:registrationID is " + data)
- })
+```js
+window.plugins.jPushPlugin.getRegistrationID(function(data) {
+ console.log("JPushPlugin:registrationID is " + data)
+})
+```
+
+
## 别名与标签
@@ -134,38 +151,43 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
#### 接口定义
- JPushPlugin.prototype.setTagsWithAlias(tags, alias)
- JPushPlugin.prototype.setTags(tags)
- JPushPlugin.prototype.setAlias(alias)
+```
+JPushPlugin.prototype.setTagsWithAlias(tags, alias)
+JPushPlugin.prototype.setTags(tags)
+JPushPlugin.prototype.setAlias(alias)
+```
#### 参数说明
-* tags:
- * 参数类型为数组。
- * nil 此次调用不设置此值。
- * 空集合表示取消之前的设置。
- * 每次调用至少设置一个 tag,覆盖之前的设置,不是新增。
- * 有效的标签组成:字母(区分大小写)、数字、下划线、汉字。
- * 限制:每个 tag 命名长度限制为 40 字节,最多支持设置 100 个 tag,但总长度不得超过1K字节(判断长度需采用UTF-8编码)。
- * 单个设备最多支持设置 100 个 tag,App 全局 tag 数量无限制。
-* alias:
- * 参数类型为字符串。
- * nil 此次调用不设置此值。
- * 空字符串 ("")表示取消之前的设置。
- * 有效的别名组成:字母(区分大小写)、数字、下划线、汉字。
- * 限制:alias 命名长度限制为 40 字节(判断长度需采用 UTF-8 编码)。
+
+- tags:
+ - 参数类型为数组。
+ - nil 此次调用不设置此值。
+ - 空集合表示取消之前的设置。
+ - 每次调用至少设置一个 tag,覆盖之前的设置,不是新增。
+ - 有效的标签组成:字母(区分大小写)、数字、下划线、汉字。
+ - 限制:每个 tag 命名长度限制为 40 字节,最多支持设置 100 个 tag,但总长度不得超过1K字节(判断长度需采用UTF-8编码)。
+ - 单个设备最多支持设置 100 个 tag,App 全局 tag 数量无限制。
+- alias:
+ - 参数类型为字符串。
+ - nil 此次调用不设置此值。
+ - 空字符串 ("")表示取消之前的设置。
+ - 有效的别名组成:字母(区分大小写)、数字、下划线、汉字。
+ - 限制:alias 命名长度限制为 40 字节(判断长度需采用 UTF-8 编码)。
#### 返回值说明
函数本身无返回值,但需要注册 `jpush.setTagsWithAlias` 事件来监听设置结果。
- var onTagsWithAlias = function(event) {
- console.log("onTagsWithAlias")
- var result = "result code:"+event.resultCode + " "
- result += "tags:" + event.tags + " "
- result += "alias:" + event.alias + " "
- $("#tagAliasResult").html(result)
- }
- document.addEventListener("jpush.setTagsWithAlias", onTagsWithAlias, false)
+```js
+var onTagsWithAlias = function(event) {
+ console.log("onTagsWithAlias")
+ var result = "result code:"+event.resultCode + " "
+ result += "tags:" + event.tags + " "
+ result += "alias:" + event.alias + " "
+ $("#tagAliasResult").html(result)
+}
+document.addEventListener("jpush.setTagsWithAlias", onTagsWithAlias, false)
+```
#### 错误码定义
@@ -181,7 +203,6 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
| 6008 | tag/alias 超出总长度限制 | 总长度最多 1K 字节。 |
| 6011 | 10s内设置tag或alias大于3次 | 短时间内操作过于频繁。 |
-
## 获取 APNS 推送内容
### 点击推送通知
@@ -194,28 +215,34 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
- 在你需要接收通知的的 js 文件中加入:
- document.addEventListener("jpush.openNotification", onOpenNotification, false)
+ ```js
+ document.addEventListener("jpush.openNotification", onOpenNotification, false)
+ ```
- onOpenNotification 需要这样写:
- var onOpenNotification = function(event) {
- var alertContent
- alertContent = event.aps.alert
- alert("open Notificaiton:" + alertContent)
- }
+ ```js
+ var onOpenNotification = function(event) {
+ var alertContent
+ alertContent = event.aps.alert
+ alert("open Notificaiton:" + alertContent)
+ }
+ ```
- event 举例:
- {
- "aps":{
- "badge":1,
- "sound":"default",
- "alert":"今天去哪儿"
- },
- "key1":"value1",
- "key2":"value2",
- "_j_msgid":154604475
- }
+ ```json
+ {
+ "aps":{
+ "badge":1,
+ "sound":"default",
+ "alert":"今天去哪儿"
+ },
+ "key1":"value1",
+ "key2":"value2",
+ "_j_msgid":154604475
+ }
+ ```
### 前台收到推送
@@ -227,28 +254,34 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
- 在你需要接收通知的的 js 文件中加入:
- document.addEventListener("jpush.receiveNotification", onReceiveNotification, false)
+ ```js
+ document.addEventListener("jpush.receiveNotification", onReceiveNotification, false)
+ ```
- onReceiveNotification 需要这样写:
- var onReceiveNotification = function(event) {
- var alertContent
- alertContent = event.aps.alert
- alert("open Notificaiton:" + alertContent)
- }
+ ```js
+ var onReceiveNotification = function(event) {
+ var alertContent
+ alertContent = event.aps.alert
+ alert("open Notificaiton:" + alertContent)
+ }
+ ```
- event 举例
- {
- "aps":{
- "badge":1,
- "sound":"default",
- "alert":"今天去哪儿"
- },
- "key1":"value1",
- "key2":"value2",
- "_j_msgid":154604475
- }
+ ```json
+ {
+ "aps":{
+ "badge":1,
+ "sound":"default",
+ "alert":"今天去哪儿"
+ },
+ "key1":"value1",
+ "key2":"value2",
+ "_j_msgid":154604475
+ }
+ ```
### 后台收到推送
@@ -260,28 +293,39 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
- 在你需要接收通知的的 js 文件中加入:
- document.addEventListener("jpush.backgroundNotification", onBackgroundNotification, false)
+ ```js
+ document.addEventListener("jpush.backgroundNotification", onBackgroundNotification, false)
+ ```
- onBackgroundNotification 需要这样写:
- var onBackgroundNotification = function(event) {
- var alertContent
- alertContent = event.aps.alert
- alert("open Notificaiton:" + alertContent)
- }
+ ```js
+ var onBackgroundNotification = function(event) {
+ var alertContent
+ alertContent = event.aps.alert
+ alert("open Notificaiton:" + alertContent)
+ }
+ ```
+
+
+- event 举例
+
+ ```json
+ {
+ "aps":{
+ "badge":1,
+ "sound":"default",
+ "alert":"今天去哪儿"
+ },
+ "key1":"value1",
+ "key2":"value2",
+ "_j_msgid":154604475
+ }
+ ```
+
+
-+ event 举例
- {
- "aps":{
- "badge":1,
- "sound":"default",
- "alert":"今天去哪儿"
- },
- "key1":"value1",
- "key2":"value2",
- "_j_msgid":154604475
- }
## 获取自定义消息内容
@@ -293,53 +337,67 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
- 在你需要接收通知的的 js 文件中加入:
- document.addEventListener("jpush.receiveMessage", onReceiveMessage, false)
+ ```js
+ document.addEventListener("jpush.receiveMessage", onReceiveMessage, false)
+ ```
- onReceiveMessage 需要这样写:
- var onReceiveMessage = function(event) {
- try {
- var message = event.content
- $("#messageResult").html(message)
- } catch(exception) {
- console.log("JPushPlugin:onReceiveMessage-->" + exception);
- }
+ ```js
+ var onReceiveMessage = function(event) {
+ try {
+ var message = event.content
+ $("#messageResult").html(message)
+ } catch(exception) {
+ console.log("JPushPlugin:onReceiveMessage-->" + exception);
}
+ }
+ ```
- event 举例:
+ ```json
+ {
+ "content":"今天去哪儿",
+ "extras":
{
- "content":"今天去哪儿",
- "extras":
- {
- "key":"不填写没有"
- }
+ "key":"不填写没有"
}
+ }
+ ```
## 设置Badge
+
### API - setBadge, resetBadge
JPush 封装 badge 功能,允许应用上传 badge 值至 JPush 服务器,由 JPush 后台帮助管理每个用户所对应的推送 badge 值,简化了设置推送 badge 的操作。
(本接口不会直接改变应用本地的角标值. 要修改本地 badege 值,使用 setApplicationIconBadgeNumber)
实际应用中,开发者可以直接对 badge 值做增减操作,无需自己维护用户与 badge 值之间的对应关系。
+
#### 接口定义
- window.plugins.jPushPlugin.prototype.setBadge(value)
- window.plugins.jPushPlugin.prototype.reSetBadge()
+```js
+window.plugins.jPushPlugin.prototype.setBadge(value)
+window.plugins.jPushPlugin.prototype.reSetBadge()
+```
resetBadge 相当于 setBadge(0)。
#### 参数说明
+
value 取值范围:[0,99999]。
#### 返回值
+
无,控制台会有 log 打印设置结果。
#### 代码示例
- window.plugins.jPushPlugin.setBadge(5)
- window.plugins.jPushPlugin.reSetBadge()
+```js
+window.plugins.jPushPlugin.setBadge(5)
+window.plugins.jPushPlugin.reSetBadge()
+```
### API - setApplicationIconBadgeNumber
@@ -347,7 +405,9 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.setApplicationIconBadgeNumber(badge)
+```js
+window.plugins.jPushPlugin.prototype.setApplicationIconBadgeNumber(badge)
+```
#### 参数说明
@@ -355,7 +415,9 @@ value 取值范围:[0,99999]。
#### 代码示例
- window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0)
+```
+window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0)
+```
### API - getApplicationIconBadgeNumber
@@ -363,7 +425,9 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.getApplicationIconBadgeNumber(callback)
+```
+window.plugins.jPushPlugin.prototype.getApplicationIconBadgeNumber(callback)
+```
#### 参数说明
@@ -371,10 +435,11 @@ value 取值范围:[0,99999]。
#### 代码示例
- window.plugins.jPushPlugin.getApplicationIconBadgeNumber(function(data) {
- console.log(data)
- })
-
+```js
+window.plugins.jPushPlugin.getApplicationIconBadgeNumber(function(data) {
+ console.log(data)
+})
+```
## 本地通知
@@ -384,7 +449,9 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.addLocalNotificationForIOS(delayTime, content, badge, notificationID, extras)
+```js
+window.plugins.jPushPlugin.prototype.addLocalNotificationForIOS(delayTime, content, badge, notificationID, extras)
+```
#### 参数说明
@@ -396,7 +463,9 @@ value 取值范围:[0,99999]。
#### 代码示例
- window.plugins.jPushPlugin.addLocalNotificationForIOS(6*60*60, "本地推送内容", 1, "notiId", {"key":"value"});
+```js
+window.plugins.jPushPlugin.addLocalNotificationForIOS(24*60*60, "本地推送内容", 1, "notiId", {"key":"value"});
+```
### API - deleteLocalNotificationWithIdentifierKeyInIOS
@@ -404,7 +473,9 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey)
+```js
+window.plugins.jPushPlugin.prototype.deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey)
+```
#### 参数说明
@@ -412,7 +483,9 @@ value 取值范围:[0,99999]。
#### 代码示例
- window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS("identifier")
+```
+window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS("identifier")
+```
### API - clearAllLocalNotifications
@@ -420,11 +493,36 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.clearAllLocalNotifications()
+```
+window.plugins.jPushPlugin.prototype.clearAllLocalNotifications()
+```
#### 代码示例
- window.plugins.jPushPlugin.clearAllLocalNotifications()
+```
+window.plugins.jPushPlugin.clearAllLocalNotifications()
+```
+
+
+
+## 获取本地通知内容
+
+### iOS 10 before 收到本地通知
+
+监听 `jpush.receiveLocalNotification` 事件获取,「App 在后台时点击通知横幅」或「App 在前台时收到」均会触发该事件。
+
+
+
+### iOS 10 收到本地通知
+
+监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。
+
+
+
+### 点击本地通知横幅启动 App
+
+监听 `jpush.startLocalNotification` 事件。
+
## 页面的统计
@@ -436,9 +534,11 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.startLogPageView(pageName)
- window.plugins.jPushPlugin.prototype.stopLogPageView(pageName)
- window.plugins.jPushPlugin.prototype.beginLogPageView(pageName, duration)
+```
+window.plugins.jPushPlugin.prototype.startLogPageView(pageName)
+window.plugins.jPushPlugin.prototype.stopLogPageView(pageName)
+window.plugins.jPushPlugin.prototype.beginLogPageView(pageName, duration)
+```
#### 参数说明
@@ -446,16 +546,18 @@ value 取值范围:[0,99999]。
- duration: 自定义的页面时间
#### 调用说明
+
应在所有的需要统计得页面得 viewWillAppear 和 viewWillDisappear 加入 startLogPageView 和 stopLogPageView 来统计当前页面的停留时间。
或者直接使用 beginLogPageView 来自定义加入页面和时间信息。
#### 代码示例
- window.plugins.jPushPlugin.beginLogPageView("newPage", 5);
- window.plugins.jPushPlugin.startLogPageView("onePage");
- window.plugins.jPushPlugin.stopLogPageView("onePage");
-
+```
+window.plugins.jPushPlugin.beginLogPageView("newPage", 5);
+window.plugins.jPushPlugin.startLogPageView("onePage");
+window.plugins.jPushPlugin.stopLogPageView("onePage");
+```
## 日志等级设置
@@ -467,11 +569,15 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.setDebugModeFromIos()
+```
+window.plugins.jPushPlugin.prototype.setDebugModeFromIos()
+```
#### 代码示例
- window.plugins.jPushPlugin.setDebugModeFromIos();
+```
+window.plugins.jPushPlugin.setDebugModeFromIos();
+```
### API - setLogOFF
@@ -481,11 +587,15 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.setLogOFF()
+```
+window.plugins.jPushPlugin.prototype.setLogOFF()
+```
#### 代码示例
- window.plugins.jPushPlugin.setLogOFF();
+```
+window.plugins.jPushPlugin.setLogOFF();
+```
### API - setCrashLogON
@@ -495,11 +605,15 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.setCrashLogON()
+```
+window.plugins.jPushPlugin.prototype.setCrashLogON()
+```
#### 代码示例
- window.plugins.jPushPlugin.setCrashLogON();
+```
+window.plugins.jPushPlugin.setCrashLogON();
+```
## 地理位置上报
@@ -509,7 +623,9 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.setLocation(latitude, longitude)
+```
+window.plugins.jPushPlugin.prototype.setLocation(latitude, longitude)
+```
#### 参数说明
@@ -518,7 +634,9 @@ value 取值范围:[0,99999]。
#### 代码示例
- window.plugins.jPushPlugin.setLocation(39.26,115.25);
+```
+window.plugins.jPushPlugin.setLocation(39.26,115.25);
+```
## 设备平台判断
@@ -528,15 +646,19 @@ value 取值范围:[0,99999]。
#### 接口定义
- window.plugins.jPushPlugin.prototype.isPlatformIOS()
+```
+window.plugins.jPushPlugin.prototype.isPlatformIOS()
+```
#### 代码示例
- if(window.plugins.jPushPlugin.isPlatformIOS()) {
- // iOS
- } else {
- // Android
- }
+```js
+if(window.plugins.jPushPlugin.isPlatformIOS()) {
+ // iOS
+} else {
+ // Android
+}
+```
@@ -577,7 +699,7 @@ window.plugins.jPushPlugin.prototype.addDismissActions(actions, categoryId);
#### 代码示例
-```
+```js
window.plugins.jPushPlugin.addDismissActions([{"title":"t1", "identifier":"id1", "option":"0"}, {"title":"t2", "identifier":"id2", "option":"3", "type":"textInput", "textInputButtonTitle":"回复", "textInputPlaceholder":"点此输入回复内容"}], "categoryId_t1_t2");
```
@@ -649,8 +771,6 @@ window.plugins.jPushPlugin.prototype.addNotificationActions(actions, categoryId)
7. 立即发送。
-
-
## 获取用户推送设置
### API - getUserNotificationSettings
@@ -681,6 +801,58 @@ window.plugins.jPushPlugin.prototype.getUserNotificationSettings(callback)
- UNNotificationSettingDisabled = 1, The notification setting is turned off.
- UNNotificationSettingEnabled = 2, The notification setting is turned on.
- 字段 alertStyle,取值如下:
- - UNAlertStyleNone = 0
- - UNAlertStyleBanner = 1
- - UNAlertStyleAlert = 2
+ - UNAlertStyleNone = 0
+ - UNAlertStyleBanner = 1
+ - UNAlertStyleAlert = 2
+
+
+
+
+## 监听事件统一说明
+
+可在 js 监听全部事件如下:
+
+##### jpush.receiveNotification
+
+> [前台收到远程通知](#前台收到推送)
+>
+> [iOS 10 前台收到本地通知](#ios-10-收到本地通知)
+
+
+
+##### jpush.openNotification
+
+> [点击远程通知横幅使 App「进入前台」或「启动」](#点击推送通知)
+>
+> [iOS 10 点击本地通知横幅使 App「进入前台」或「启动」](#ios-10-收到本地通知)
+
+
+
+##### jpush.backgroundNotification
+
+> [iOS 7 以后后台收到远程通知](#后台收到推送)
+
+
+
+##### jpush.setTagsWithAlias
+
+> [设置标签别名回调](#返回值说明)
+
+
+
+##### jpush.receiveMessage
+
+> [获取自定义消息内容](#获取自定义消息内容)
+
+
+
+##### jpush.startLocalNotification
+
+> [点击本地通知横幅启动 App](#点击本地通知横幅启动-app)
+
+
+
+##### jpush.receiveLocalNotification
+
+> [iOS 10 before 收到本地通知](#ios-10-before-收到本地通知)
+
diff --git a/doc/iOS_install.md b/doc/iOS_install.md
index 8d5582b..83bc997 100644
--- a/doc/iOS_install.md
+++ b/doc/iOS_install.md
@@ -1,27 +1,29 @@
## iOS 手动安装
-不建议使用手动安装,请参照 README.md 进行自动安装。
+> **不建议使用手动安装,请参照 README.md 进行自动安装。**
+
+
1. 下载 JPush PhoneGap Plugin 插件,并解压
2. 将 [/src/ios](/src/ios) 文件夹及内容在 xcode 中拖到你的工程里,并配置 [/src/ios/PushConfig.plist](/src/ios/PushConfig.plist) 中相应参数:
- Appkey: 应用标识
- Channel: 渠道标识
- IsProduction:是否生产环境
- IsIDFA: 是否使用 IDFA 启动 sdk
+ Appkey: 应用标识
+ Channel: 渠道标识
+ IsProduction:是否生产环境
+ IsIDFA: 是否使用 IDFA 启动 sdk
3. 打开 xcode,点击工程目录中顶部的 工程,选择(Target -> Build Phases -> Link Binary With Libraries),添加以下框架:
- CFNetwork.framework
- CoreFoundation.framework
- CoreTelephony.framework
- SystemConfiguration.framework
- CoreGraphics.framework
- Foundation.framework
- UIKit.framework
- AdSupport.framework
- libz.tbd(若存在 libz.dylib 则替换为 libz.tbd)
- UserNotifications.framework
- libresolv.tbd
+ CFNetwork.framework
+ CoreFoundation.framework
+ CoreTelephony.framework
+ SystemConfiguration.framework
+ CoreGraphics.framework
+ Foundation.framework
+ UIKit.framework
+ AdSupport.framework
+ libz.tbd(若存在 libz.dylib 则替换为 libz.tbd)
+ UserNotifications.framework
+ libresolv.tbd
4. 修改 phonegap config.xml 文件以添加 JPushPlugin 插件
```xml
diff --git a/example/index.html b/example/index.html
index eb8b11b..93371b3 100644
--- a/example/index.html
+++ b/example/index.html
@@ -88,7 +88,7 @@
var initiateUI = function() {
try {
window.plugins.jPushPlugin.init();
- getRegistrationID();
+ window.setTimeout(getRegistrationID, 1000);
if (device.platform != "Android") {
window.plugins.jPushPlugin.setDebugModeFromIos();
window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
diff --git a/plugin.xml b/plugin.xml
index ba51f47..05e1464 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -30,14 +30,17 @@
+
-
+
-
+
+
+
diff --git a/src/ios/Plugins/AppDelegate+JPush.h b/src/ios/Plugins/AppDelegate+JPush.h
index 5420b50..05b1ad0 100644
--- a/src/ios/Plugins/AppDelegate+JPush.h
+++ b/src/ios/Plugins/AppDelegate+JPush.h
@@ -2,7 +2,7 @@
// AppDelegate+JPush.h
// delegateExtention
//
-// Created by pikacode@qq.com on 15/8/3.
+// Created by 张庆贺 on 15/8/3.
// Copyright (c) 2015年 JPush. All rights reserved.
//
diff --git a/src/ios/Plugins/AppDelegate+JPush.m b/src/ios/Plugins/AppDelegate+JPush.m
index f01a1fc..e5f7d82 100644
--- a/src/ios/Plugins/AppDelegate+JPush.m
+++ b/src/ios/Plugins/AppDelegate+JPush.m
@@ -2,7 +2,7 @@
// AppDelegate+JPush.m
// delegateExtention
//
-// Created by pikacode@qq.com on 15/8/3.
+// Created by 张庆贺 on 15/8/3.
// Copyright (c) 2015年 JPush. All rights reserved.
//
@@ -28,8 +28,6 @@
return [self init_plus];
}
-
-
-(void)applicationDidLaunch:(NSNotification *)notification{
if (notification) {
if (notification.userInfo) {
@@ -39,7 +37,7 @@
}
NSDictionary *userInfo2 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (userInfo2.count > 0) {
- [SharedJPushPlugin jpushFireDocumentEvent:JPushDocumentEvent_OpenLocalNotification jsString:[userInfo1 toJsonString]];
+ [SharedJPushPlugin jpushFireDocumentEvent:JPushDocumentEvent_StartLocalNotification jsString:[userInfo1 toJsonString]];
}
}
[JPUSHService setDebugMode];
@@ -91,7 +89,7 @@
eventName = JPushDocumentEvent_ReceiveNotification;
break;
case UIApplicationStateBackground:
- eventName = JPushDocumentEvent_BackgoundNotification;
+ eventName = JPushDocumentEvent_BackgroundNotification;
break;
default:
break;
@@ -117,7 +115,7 @@
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
- // [[NSNotificationCenter defaultCenter] postNotificationName:kJPushPluginReceiveLocalNotification object:notification.userInfo];
+ [[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:notification.userInfo];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
diff --git a/src/ios/Plugins/JPushDefine.h b/src/ios/Plugins/JPushDefine.h
index 002721c..3e58b11 100644
--- a/src/ios/Plugins/JPushDefine.h
+++ b/src/ios/Plugins/JPushDefine.h
@@ -2,7 +2,7 @@
// ConstantDef.h
// jmessage
//
-// Created by pikacode@qq.com on 16/1/19.
+// Created by ljg on 16/1/19.
//
//
@@ -21,11 +21,12 @@ static NSString *const JPushConfig_IsProduction = @"IsProduction";
static NSString *const JPushConfig_IsIDFA = @"IsIDFA";
static NSString *const JPushConfig_FileName = @"PushConfig";
-static NSString *const JPushDocumentEvent_ReceiveNotification = @"receiveNotification";
-static NSString *const JPushDocumentEvent_OpenNotification = @"openNotification";
-static NSString *const JPushDocumentEvent_BackgoundNotification = @"backgoundNotification";
-static NSString *const JPushDocumentEvent_SetTagsWithAlias = @"setTagsWithAlias";
-static NSString *const JPushDocumentEvent_ReceiveMessage = @"receiveMessage";
-static NSString *const JPushDocumentEvent_OpenLocalNotification = @"openLocalNotification";
+static NSString *const JPushDocumentEvent_ReceiveNotification = @"receiveNotification";
+static NSString *const JPushDocumentEvent_OpenNotification = @"openNotification";
+static NSString *const JPushDocumentEvent_BackgroundNotification = @"backgroundNotification";
+static NSString *const JPushDocumentEvent_SetTagsWithAlias = @"setTagsWithAlias";
+static NSString *const JPushDocumentEvent_ReceiveMessage = @"receiveMessage";
+static NSString *const JPushDocumentEvent_StartLocalNotification = @"startLocalNotification";
+static NSString *const JPushDocumentEvent_ReceiveLocalNotification = @"receiveLocalNotification";
diff --git a/src/ios/Plugins/JPushPlugin.h b/src/ios/Plugins/JPushPlugin.h
index a0869f6..05c34d4 100644
--- a/src/ios/Plugins/JPushPlugin.h
+++ b/src/ios/Plugins/JPushPlugin.h
@@ -2,7 +2,7 @@
// PushTalkPlugin.h
// PushTalk
//
-// Created by pikacode@qq.com on 13-12-13.
+// Created by zhangqinghe on 13-12-13.
//
//
diff --git a/src/ios/Plugins/JPushPlugin.m b/src/ios/Plugins/JPushPlugin.m
index e659c66..cef1785 100644
--- a/src/ios/Plugins/JPushPlugin.m
+++ b/src/ios/Plugins/JPushPlugin.m
@@ -2,7 +2,7 @@
// PushTalkPlugin.m
// PushTalk
//
-// Created by pikacode@qq.com on 13-12-13.
+// Created by zhangqinghe on 13-12-13.
//
//
@@ -164,7 +164,7 @@
NSNumber *badge = [command argumentAtIndex:2];
NSString *idKey = [command argumentAtIndex:3];
NSDictionary *dict = [command argumentAtIndex:4];
- [JPUSHService setLocalNotification:date alertBody:alert badge:badge alertAction:nil identifierKey:idKey userInfo:dict soundName:nil];
+ [JPUSHService setLocalNotification:date alertBody:alert badge:badge.intValue alertAction:nil identifierKey:idKey userInfo:dict soundName:nil];
}
-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command{
@@ -266,7 +266,7 @@
NSNumber *isIDFA = [plistData valueForKey:JPushConfig_IsIDFA];
NSString *advertisingId = nil;
- if(isIDFA){
+ if(isIDFA.boolValue){
advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
}
[JPUSHService setupWithOption:userInfo
diff --git a/src/ios/lib/JPUSHService.h b/src/ios/lib/JPUSHService.h
index e5424a3..13cb9d4 100644
--- a/src/ios/lib/JPUSHService.h
+++ b/src/ios/lib/JPUSHService.h
@@ -9,7 +9,7 @@
* Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved.
*/
-#define JPUSH_VERSION_NUMBER 2.2.0
+#define JPUSH_VERSION_NUMBER 3.0.0
#import
@@ -31,6 +31,13 @@ extern NSString *const kJPFNetworkDidLoginNotification; // 登录成功
extern NSString *const kJPFNetworkDidReceiveMessageNotification; // 收到消息(非APNS)
extern NSString *const kJPFServiceErrorNotification; // 错误提示
+typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
+ JPAuthorizationOptionNone = 0, // the application may not present any UI upon a notification being received
+ JPAuthorizationOptionBadge = (1 << 0), // the application may badge its icon upon a notification being received
+ JPAuthorizationOptionSound = (1 << 1), // the application may play a sound upon a notification being received
+ JPAuthorizationOptionAlert = (1 << 2), // the application may display an alert upon a notification being received
+};
+
/*!
* 通知注册实体类
*/
@@ -186,7 +193,7 @@ extern NSString *const kJPFServiceErrorNotification; // 错误提示
/*!
* 下面的接口是可选的
- * 设置标签和(或)别名(若参数为nil,则忽略;若是空对象,则清空;详情请参考文档:http://docs.jiguang.cn/client/ios_api/#api-ios)
+ * 设置标签和(或)别名(若参数为nil,则忽略;若是空对象,则清空;详情请参考文档:https://docs.jiguang.cn/jpush/client/iOS/ios_api/)
* setTags:alias:fetchCompletionHandle:是新的设置标签别名的方法,不再需要显示声明回调函数,只需要在block里面处理设置结果即可.
* WARN: 使用block时需要注意循环引用问题
*/
@@ -243,7 +250,7 @@ callbackSelector:(SEL)cbSelector
+ (void)stopLogPageView:(NSString *)pageName;
/*!
- * @abstract 直接上报在页面的停留时工
+ * @abstract 直接上报在页面的停留时间
*
* @param pageName 页面
* @param seconds 停留的秒数
@@ -364,7 +371,6 @@ callbackSelector:(SEL)cbSelector
* @abstract 删除本地推送定义
*
* @param notificationKey 本地推送标示符
- * @param myUILocalNotification 本地推送对象
* @discussion 此方法被[removeNotification:]方法取代
*/
+ (void)deleteLocalNotificationWithIdentifierKey:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期")));
diff --git a/src/ios/lib/jpush-ios-2.2.0.a b/src/ios/lib/jcore-ios-1.0.0.a
similarity index 59%
rename from src/ios/lib/jpush-ios-2.2.0.a
rename to src/ios/lib/jcore-ios-1.0.0.a
index 9e48b2d..dfc687d 100644
Binary files a/src/ios/lib/jpush-ios-2.2.0.a and b/src/ios/lib/jcore-ios-1.0.0.a differ
diff --git a/src/ios/lib/jpush-ios-3.0.0.a b/src/ios/lib/jpush-ios-3.0.0.a
new file mode 100644
index 0000000..74f2dc9
Binary files /dev/null and b/src/ios/lib/jpush-ios-3.0.0.a differ