[英]Inter App communication between apps present in foreground
我正在構建sdk,它在某個時間點需要與第三方應用程序通信,並且廣泛地通信意味着在某些情況下通知某些事件可能會也可能沒有任何數據。
我使用NotificationCenter
來做這個,但現在我發現某處寫的是用於應用內部通信。 這就是我運行代碼時發現的行為。
NotificationCenter.default.post(name: action, object: nil, userInfo: jsonObject)
這是我在sdk中添加的聽眾
NotificationCenter.default.addObserver(self, selector: #selector(onReceive(_:)), name: Notification.Name.ACTION_PAYMENT_ACK, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(onReceive(_:)), name: Notification.Name.ACTION_PAYMENT_CMP, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(onReceive(_:)), name: Notification.Name.ACTION_PAYMENT_REJ, object: nil)
我還發現了一些與達爾文通知有關的內容,但這個帖子太舊了。 我該如何進行應用間通信。
我正在尋找像Android中的廣播一樣的東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.