I need to pass data on subscribing to a notification, so, I've taken the example code in Module_07_04_iOSNativePush app and added the following code to the connect method (in ViewController.m):
NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:
@"userName", @"DoronK",
@"password", @"testPwd", nil];
id pushit = [WLPushOptions new];
[pushit addSubscriptionParameter:@"test" :@"Test1"];
[pushit addSubscriptionParameters:dic];
[[WLPush sharedInstance] subscribe:readyToSubscribeListener.alias: pushit :connectListener];
This does not throw any errors, but, when I run the example PushAdapter code, and adding to the adapter using this:
var usub = 'json:'+JSON.stringify(userSubscription);
...
return { result: "Notification sent to user :: " + userId +
", wait " + waittime + " before sending another. UserSub:" + usub};
The result in the adapter is:
{
"isSuccessful": true,
"result": "Notification sent to user :: worklight, wait 0 before sending another.
UserSub:json:{\"userId\":\"worklight\",\"state\":{}}"
}
I would expect the variables that I passed in via the dictionary under "state", correct? Is there another way in the adapter to get the parameters that were passed in on the [WLPush subscribe] call?
As you can probably tell, I am VERY new to Objective C, so, don't assume the call to the subscribe is done correctly. Also, I'm using Worklight Studio 6 with Fix Pack 1.