2012-07-30 66 views
1

在向xtify管理器註冊deviceToken後,如何知道xid何時可用?Xtify iOS API 2.0檢索XID

我這樣做:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    XLXtifyOptions *anXtifyOptions=[XLXtifyOptions getXtifyOptions]; 
    [[XLappMgr get ]initilizeXoptions:anXtifyOptions]; 
    [[XLappMgr get] launchWithOptions:application andOptions:launchOptions]; 
} 

然後

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken 
{ 
    [[XLappMgr get] registerWithXtify:devToken ]; 
} 

,它是打印出XID等東西到控制檯,但我需要得到它的應用程序,所以我可以將其註冊到我自己的服務器(然後使用推送REST api向個人用戶發送消息)。

我注意到XLappMgr有一個-(NSString *)getXid;方法,但我怎麼知道我什麼時候可以調用它?是否有一個委託方法在可用時被調用,還是需要進行輪詢?

Regards

+2

我們增加了積壓的項目,以使提醒註冊成功。我們將在我們的SDK門戶上提供該問題時更新此問題。 – 2012-07-30 19:02:45

+1

@Dylan請在我的答案中檢查編輯 – Suchi 2012-07-31 17:57:44

+1

謝謝,這比我的其他解決方案使用performSelector延遲一直到它出現之前都要乾淨得多。 – Dylan 2012-08-07 01:38:24

回答

3

此時沒有委託方法。你是對的,你需要輪詢它或在應用程序到達前臺時第二次檢查它。

編輯:

現在有與Xtify註冊​​成功後得到通知的方式。首先,你需要指定委託 -

[[XLappMgr get] setInboxDelegate:self]; // The delegate is used to all Xtify delegation methods. 
[[XLappMgr get] setDeveloperXidNotificationSelector:@selector(doUpdateDevServer:)]; 

然後,你需要實現方法本身 -

- (void) doUpdateXid:(XLappMgr *)appM 
{ 
    NSLog(@"Got XID=%@",[appM getXid]); 
    // Example, update the xid on developer's server 
} 

你會發現細節here

+1

謝謝Suchi。我一直在努力,直到現在:) – nasaa 2013-01-03 10:47:57