LoginSignup
3
3

More than 5 years have passed since last update.

PushMeBabyの使い方

Posted at

PushMeBabyというMacOS上からiOS上のアプリにプッシュ通知を送信するツールの使い方を調べたので、ここに残しておきます。但し、記憶を遡って書いてるのでなんか間違ってるかも。あと私はiOS関連のことは殆ど知らないので、適当な事書いてるかもしれません。

PushMeBabyの実行までの流れ

[1] コードをGithubから取得する

$git clone https://github.com/stefanhafeneger/PushMeBaby.git

[2] Xcodeを起動してPushMeBaby.xcodeprojを開く

  • xcodeを起動
  • File -> Open -> PushMeBaby.xcodeprojを選択

[3] Push通知に使う証明書をプロジェクトに追加する

  • Project Navigatorの画面上でResourcesフォルダを右クリック
  • Add Files to "PushMeBaby"
  • Push通知に使う証明書を選択

[4] ApplicationDelegate.m fileの変更

certificate変数に代入する値を[3]で追加した証明書のファイル名に変更する。

ApplicationDelegate.m
        self.certificate = [[NSBundle mainBundle] 
            pathForResource:@"aps_developer_identity" ofType:@"cer"];

例えばhoge.certを追加してたら

ApplicationDelegate.m
        self.certificate = [[NSBundle mainBundle] 
            pathForResource:@"hoge" ofType:@"cer"];

というような感じ.

以下のdeviceTokenは書き換えなくても良いが、テストの度に入力するのが面倒なので直接コードに書くほうが楽。

ApplicationDelegate.m
        self.deviceToken = @"";

ちなみに8文字毎に空白を入れる必要がある。

ApplicationDelegate.m
        self.deviceToken = @"38c866dd bb323b39 ffa73487 5e157ee5 a85e0b7c e90d56e9 fe145bcc 6c2c594b";

[5] Command+RでPushMeBabyの実行

  • ダイアログが出てくるので、Push通知したいデバイスのデバイストークンをテキストボックスに入力(8文字毎に空白を入力)
  • Pushボタンを押すと、ダイアログのPayloadに書かれている内容の通知がアップルのサーバーを経由して指定したデバイスに届くはず

参考

iOS Push Notification Debug App
https://github.com/stefanhafeneger/PushMeBaby

Programming Apple Push Notification Services
http://mobiforge.com/design-development/programming-apple-push-notification-services

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3