2017-05-29 71 views
0

我們通過的appdelegate完成處理程序urbanairship並調用的appdelegate完成處理程序在年底手動城市飛艇調用UAAppIntegration.userNotificationCenter需要調用completionHandler?

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping() -> Swift.Void) { 
    UAAppIntegration.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler) 
    completionHandler() 
} 

或我們所說的urbanairship完成

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping() -> Swift.Void) { 
    UAAppIntegration.userNotificationCenter(center, didReceive: response) { 
     completionHandler() 
    } 
} 

,或者我們只是通過完成內的appdelegate完成處理到城市樓梯(那麼如果我們有代碼,我們需要在呼叫城市樓梯之前打電話給它)

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping() -> Swift.Void) { 
    UAAppIntegration.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler) 
} 

回答

0

您想要做第二或第三選項。完成處理程序只能被調用一次。查看docs,瞭解您需要撥打UA的所有地點和示例。

+0

我想,但因爲它是一個黑匣子,所以他們不會說他們是否會在完成處理程序時調用完成處理程序,或者如果我們處理了某些事情,我們就不應該將它轉發給城市? – CiNN

+0

SDK是開源的,所以它不是一個真正的黑盒子。回調將始終由UA調用。 – ralepinski