質問

はありますgrockパターンを送信するには、id)sender(目的)|通知(Swift)のお受け取り方法。コードスニペット?のドキュメントを書くように150ページに成長を続けていきます。ということ、迅速例です。

役に立ちましたか?

解決

通知を送信します:

[[NSNotificationCenter defaultCenter] postNotificationName:@"MyCacheUpdatedNotification" object:self];

受け取る:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cacheUpdated:) name:@"MyCacheUpdatedNotification" object:nil];

それに基づいて行動します:

- (void)cacheUpdated:(NSNotification *)notification {
[self load];
}

そしてそれを処分します:

[[NSNotificationCenter defaultCenter] removeObserver:self];

他のヒント

同じための迅速なバージョン:

通知を投稿する必要があるときはいつでも:

NotificationCenter.default.post(name: NSNotification.Name(rawValue: "UpdateAccepted"), object: self)

通知を受信するコントローラーで:

override func viewDidLoad(_ animated: Bool) {
    super.viewDidLoad(true) {
    NotificationCenter.default.addObserver(self, selector: #selector(updateAccepted(notification:)), name: NSNotification.Name(rawValue: "UpdateAccepted"), object: nil)
}

deinit {
    NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: "UpdateAccepted"), object: nil)
}

@objc func updateAccepted(notification: Notification) {
    handleRefresh()
}
  1. 登録のためのプッシュ通知のプロファイルセットでお申込ニークな PushNotification (注意が必要となりま一部のサーバーや撮影装置に押しnotificaiton Idできるよう通知を送信するデバイス)

  2. 次のとお使いのWindowsサーバーか何かにする。net対応としてサーバーが素敵C#api書の送付プッシュ通知は、apple社のサーバー(一度申込書(web登録)の際に記載し、デバイスに登録されます保存したサーバーがあり、デモにこちらの使い方を指導することもでき、かなり涼しいニのリンク C#プッシュ通知src造

粉遊んで---私たu、迅速なソリューションを使用。Net技術をご利用の場合somethignかを閲覧することができる場ができるものであり、プラットフォームのご利用imだ誰も見てない場合、まalwyas自:)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top