mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-04-17 21:18:37 +08:00
iOS - update
1.更新api说明 2.代码处理null
This commit is contained in:
parent
c74b8372c0
commit
cf39b64bfc
@ -16,7 +16,7 @@
|
||||
|
||||
- data 是一个js字符串使用如下代码解析,js具体key根据应用内消息来确定
|
||||
|
||||
var bToObj = JSON.parse(data);
|
||||
var bToObj = JSON.parse(data)
|
||||
|
||||
#####返回值
|
||||
无
|
||||
@ -131,7 +131,7 @@ API用于注册本地通知
|
||||
|
||||
#####代码示例
|
||||
|
||||
window.plugins.jPushPlugin.addLocalNotificationForIOS(6*60*60,"本地推送内容",1,"notiId",{"key":"value"})
|
||||
window.plugins.jPushPlugin.addLocalNotificationForIOS(6*60*60,"本地推送内容",1,"notiId",{"key":"value"});
|
||||
|
||||
#### API - deleteLocalNotificationWithIdentifierKeyInIOS
|
||||
|
||||
@ -147,7 +147,7 @@ API删除本地推送定义
|
||||
|
||||
#####代码示例
|
||||
|
||||
window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS("identifier")
|
||||
window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS("identifier");
|
||||
|
||||
#### API - clearAllLocalNotifications
|
||||
|
||||
@ -159,7 +159,7 @@ API清除所有本地推送对象
|
||||
|
||||
#####代码示例
|
||||
|
||||
window.plugins.jPushPlugin.clearAllLocalNotifications()
|
||||
window.plugins.jPushPlugin.clearAllLocalNotifications();
|
||||
|
||||
### 日志等级设置
|
||||
#### API - setDebugModeFromIos
|
||||
@ -182,7 +182,7 @@ API用来关闭日志信息(除了必要的错误信息)
|
||||
|
||||
##### 接口定义
|
||||
|
||||
window.plugins.jPushPlugin.prototype.setLogOFF ()
|
||||
window.plugins.jPushPlugin.prototype.setLogOFF()
|
||||
|
||||
#####代码示例
|
||||
|
||||
@ -197,12 +197,29 @@ API用于统计用户应用崩溃日志
|
||||
|
||||
##### 接口定义
|
||||
|
||||
window.plugins.jPushPlugin.prototype.setCrashLogON ()
|
||||
window.plugins.jPushPlugin.prototype.setCrashLogON()
|
||||
|
||||
#####代码示例
|
||||
|
||||
window.plugins.jPushPlugin.setCrashLogON()
|
||||
window.plugins.jPushPlugin.setCrashLogON();
|
||||
|
||||
### 地理位置上报
|
||||
#### API - setLocation
|
||||
API 用于统计用户地理信息
|
||||
|
||||
##### 接口定义
|
||||
|
||||
window.plugins.jPushPlugin.prototype.setLocation(latitude,longitude)
|
||||
|
||||
##### 参数说明
|
||||
|
||||
- latitude 地理位置纬度,数值类型或纯数字的字符型均可
|
||||
- longitude 地理位置精度,数值类型或纯数字的字符型均可
|
||||
|
||||
#####代码示例
|
||||
|
||||
window.plugins.jPushPlugin.setLocation(39.26,115.25);
|
||||
|
||||
### 设备平台判断
|
||||
#### API - isPlatformIOS
|
||||
API 用于区分iOS、Android平台,以便不同设置
|
||||
|
@ -238,12 +238,12 @@ static NSDictionary *_luanchOptions = nil;
|
||||
}
|
||||
|
||||
-(void)setLocalNotification:(CDVInvokedUrlCommand*)command{
|
||||
NSArray *arguments = command.arguments;
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:[((NSString*)arguments[0]) intValue]];
|
||||
NSString *alertBody = (NSString*)arguments[1];
|
||||
int badge = [(NSString*)arguments[2] intValue];
|
||||
NSString *idKey = (NSString*)arguments[3];
|
||||
NSDictionary *dict = (NSDictionary*)arguments[4];
|
||||
NSArray *arguments = command.arguments;
|
||||
NSDate *date = arguments[0] == [NSNull null] ? nil : [NSDate dateWithTimeIntervalSinceNow:[((NSString*)arguments[0]) intValue]];
|
||||
NSString *alertBody = arguments[1] == [NSNull null] ? nil : (NSString*)arguments[1];
|
||||
int badge = arguments[2] == [NSNull null] ? 0 : [(NSString*)arguments[2] intValue];
|
||||
NSString *idKey = arguments[3] == [NSNull null] ? nil : (NSString*)arguments[3];
|
||||
NSDictionary *dict = arguments[4] == [NSNull null] ? nil : (NSDictionary*)arguments[4];
|
||||
[JPUSHService setLocalNotification:date alertBody:alertBody badge:badge alertAction:nil identifierKey:idKey userInfo:dict soundName:nil];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user