我需要通過上預訂通知數據,因此,我已經採取在Module_07_04_iOSNativePush應用中的示例代碼,並添加以下代碼以在連接方法(在ViewController.m ):傳數據訂閱使用WLPush爲工作燈的iOS通知
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];
這不拋出任何錯誤,但是,當我運行示例PushAdapter代碼,並使用此增加了適配器:
var usub = 'json:'+JSON.stringify(userSubscription);
...
return { result: "Notification sent to user :: " + userId +
", wait " + waittime + " before sending another. UserSub:" + usub};
在適配器的結果是:
{
"isSuccessful": true,
"result": "Notification sent to user :: worklight, wait 0 before sending another.
UserSub:json:{\"userId\":\"worklight\",\"state\":{}}"
}
我希望,我通過「狀態」下的字典傳入的,正確的變量?在適配器中是否有另一種方式來獲取在[WLPush訂閱]調用中傳入的參數?
正如你可能會說,我是很新的目標C,因此,在認購做得正確不承擔呼叫。另外,我用工作燈工作室6修訂包1
這回答了這個問題的一部分,但是,爲什麼不是這個由pushit WLPushOptions得救嗎? – DavidW