fix set tag/alias

This commit is contained in:
zhangqinhghe 2014-06-06 18:15:08 +08:00
parent 599952976f
commit 108b507210
3 changed files with 22 additions and 10 deletions

View File

@ -87,9 +87,21 @@
try{ try{
var tag1 = $("#tagText1").attr("value"); var tag1 = $("#tagText1").attr("value");
console.log("tag1:"+tag1); var tag2 = $("#tagText2").attr("value");
var tag3 = $("#tagText3").attr("value");
window.plugins.jPushPlugin.setTagsWithAlias("myTags","myTags1","myTags2","myAlias"); var alias = $("#aliasText").attr("value");
console.log("tag1:"+tag1==null);
console.log("tag1:"+tag2==null);
console.log("tag1:"+tag3==null);
var dd = [];
dd[0]=tag1
dd[1]=tag2
dd[2]=tag3
console.log("dd:"+dd);
window.plugins.jPushPlugin.setTagsWithAlias(dd,alias);
} }
catch(exception){ catch(exception){
console.log(exception); console.log(exception);

View File

@ -19,11 +19,11 @@
[self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",@""]]; [self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",@""]];
return ; return ;
} }
NSString *tags=[arguments objectAtIndex:0]; NSString *alias=[arguments objectAtIndex:0];
NSString *alias=[arguments objectAtIndex:1]; NSArray *arrayTags=[arguments objectAtIndex:1];
NSArray *arrayTags=[tags componentsSeparatedByString:@","];
// NSArray *tags=[arguments subarrayWithRange:range]; // NSArray *tags=[arguments subarrayWithRange:range];
[APService setTags:[NSSet setWithArray:arrayTags] NSSet* set=[NSSet setWithArray:arrayTags];
[APService setTags:set
alias:alias alias:alias
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:) callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
object:self]; object:self];

View File

@ -93,7 +93,7 @@ JPushPlugin.prototype.setTags = function (data) {
this.call_native("setTags", [data]); this.call_native("setTags", [data]);
} }
catch(exception){ catch(exception){
alert(exception); console.log(exception);
} }
} }
JPushPlugin.prototype.setAlias = function (data) { JPushPlugin.prototype.setAlias = function (data) {
@ -104,7 +104,7 @@ JPushPlugin.prototype.setAlias = function (data) {
} }
catch(exception){ catch(exception){
alert(exception); console.log(exception);
} }
} }
JPushPlugin.prototype.pushCallback = function (data) { JPushPlugin.prototype.pushCallback = function (data) {
@ -117,7 +117,7 @@ JPushPlugin.prototype.pushCallback = function (data) {
} }
catch(exception){ catch(exception){
alert(exception); console.log(exception);
} }
} }
JPushPlugin.prototype.registrationCallback = function (data) { JPushPlugin.prototype.registrationCallback = function (data) {
@ -125,7 +125,7 @@ JPushPlugin.prototype.registrationCallback = function (data) {
console.log("registrationCallback--registraionID is "+data); console.log("registrationCallback--registraionID is "+data);
} }
catch(exception){ catch(exception){
alert(exception); console.log(exception);
} }
} }
if(!window.plugins) { if(!window.plugins) {