Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
debug-remote-local-notification-on-watchos
Search
Shinichi Goto
April 20, 2016
Programming
0
10k
debug-remote-local-notification-on-watchos
potatotips #28
Shinichi Goto
April 20, 2016
Tweet
Share
More Decks by Shinichi Goto
See All by Shinichi Goto
WWDC18 ML Overview
_shingt
1
1.3k
Core ML 🏃 iOS Engineer
_shingt
1
480
Core ML / Vision Frameworkを使ってできること / What can we achieve using Core ML and Vision framework
_shingt
3
4.1k
Wantedly Peopleのスキャン画面の裏側 / Wantedly People Scanning Screen
_shingt
6
6.2k
Providing Better Feedback in Real-time Object Detection Apps
_shingt
2
1.4k
Value Types in WWDC16
_shingt
3
2.5k
Server Side Swift question
_shingt
3
940
Other Decks in Programming
See All in Programming
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
880
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
初めてDefinitelyTypedにPRを出した話
syumai
0
400
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
C++でシェーダを書く
fadis
6
4.1k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Featured
See All Featured
BBQ
matthewcrist
85
9.3k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
GitHub's CSS Performance
jonrohan
1030
460k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
A better future with KSS
kneath
238
17k
Designing for humans not robots
tammielis
250
25k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Teambox: Starting and Learning
jrom
133
8.8k
How to Ace a Technical Interview
jacobian
276
23k
A designer walks into a library…
pauljervisheath
203
24k
Transcript
Debug Remote / Local No1fica1on on watchOS ɹ potato%ps-28 2016/4/20
@shingt
Wantedly
No#fica#ons
None
watchOS No+fica+on Components • Short-look • Long-look • Sta.c •
Dynamic • Remote or Local • Ac.onable items • First view (kinds different from iOS)
watchOS No+fica+on Components • Short-look • Long-look • Sta.c •
Dynamic • Remote or Local • Ac.onable items • First view (kinds different from iOS)
Complicated (Compared to iOS)
Debugging
Debug No)fica)on • Remote no)fica)on • On simulator • On
device • Local no)fica)on • On simulator • On device
Remote No(fica(on • On simulator • Provided on Xcode !
• Custom Build Scheme with No8fica8on Interface • Describe no8fica8on payload in json • breakpoint "
MessagePayload.apns { "aps": { "alert": { "body": "Wantedly, Inc.͔Βϝοηʔδ͕ಧ͖·ͨ͠", "title":
"৽ணϝοηʔδ" }, "category": "MESSAGE_CATEGORY", }, "message": { "id": 1, "body": "͜ΜʹͪʂాதͰ͢ɻ\n͜ͷWantedlyʹڵຯΛ͍࣋ͬͯͯ͋Γ͕ͱ͏͍͟͝·͢ɻ", "company_name": "Wantedly, Inc.", ... }, "WatchKit Simulator Actions": [ ... ] }
Remote No(fica(on • On simulator • Provided on Xcode !
• Custom Build Scheme with No:fica:on Interface • Describe no:fica:on payload in json • breakpoint " • On device • Just send it :)
Local No(fica(on on Simulator • Want • Easily debug •
Problem • Not provided on Xcode • Different from remote no=fica=on on simulator • Solu=on? • Use remote no=fica=on debugging instead?
Solu%on? ## Debug override func didReceiveRemoteNotification( remoteNotification: [NSObject : AnyObject],
withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void) {...} ## Production override func didReceiveLocalNotification( localNotification: UILocalNotification, withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void) {...}
Problem ## Debug override func didReceiveRemoteNotification( remoteNotification: [NSObject : AnyObject],
withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void) {...} ## Production override func didReceiveLocalNotification( localNotification: UILocalNotification, withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void) {...} ɹ remoteNotification != localNotification
Sender UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = [company.name stringByAppendingString:@"͕ۙ͘ʹ͋Γ·͢"];
notification.alertTitle = @"ۙ͘ͷձࣾ"; notification.category = @"COMPANY_LOCATION"; notification.userInfo = [company toJSON];
Prepare wrapper object
None
None
• Easy to debug • Assump1on: NotificationPayload works appropriately •
Cannot test sender
Local No(fica(on on Device • Problem • Hard to send
(depending on applica5on) • Needs to send no5fica5on while iOS device is asleep • Solu5on • Basically same as debugging iOS local no5fica5on
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:... { ... [self methodForLocalNotification]; // For
debug ... }
Run iOS app => Sleep => "Simulate Background Fetch"
Summary • Debugging No,fica,on • Remote...؆୯ • Local...γϛϡϨʔλͷ߹ͪΐͬͱ͢Δ ͱྑͦ͞͏
ऴΘΓ !