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
9.9k
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.2k
Core ML 🏃 iOS Engineer
_shingt
1
460
Core ML / Vision Frameworkを使ってできること / What can we achieve using Core ML and Vision framework
_shingt
3
4k
Wantedly Peopleのスキャン画面の裏側 / Wantedly People Scanning Screen
_shingt
6
6.1k
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
910
Other Decks in Programming
See All in Programming
Using Livebook to build and deploy internal tools @ ElixirConf 2024
hugobarauna
0
220
労務ドメインを快適に開発する方法 / How to Comfortably Develop in the Labor Domain
yuki21
1
250
Architecture Decision Record (ADR)
nearme_tech
PRO
1
470
座談会 「Strict ConcurrencyとSwift 6が開く新時代: 私たちはどう生きるか?」
shiz
4
8.4k
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
210
connect-go で面倒くささと戦う / 2024-08-27 #newmo_layerx_go
izumin5210
2
610
Mergeable Libraryで 高速なアプリ起動を実現しよう!
giginet
PRO
1
2k
1人で挑むSwiftコンパイラ 〜型システム入門編〜
s_shimotori
0
320
RAGの回答精度評価用のQAデータセットを生成AIに作らせた話
kurahara
0
220
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
1
1.1k
Hono・Prisma・AWSでGeoなAPI開発
nokonoko1203
5
630
プログラマのための音楽入門
cheebow
5
550
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
230
17k
Designing with Data
zakiwarfel
98
5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
22
3.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
42
2k
Automating Front-end Workflow
addyosmani
1365
200k
Building Your Own Lightsaber
phodgson
101
6k
[RailsConf 2023] Rails as a piece of cake
palkan
45
4.6k
Faster Mobile Websites
deanohume
304
30k
Git: the NoSQL Database
bkeepers
PRO
425
64k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
230
130k
How STYLIGHT went responsive
nonsquared
93
5.1k
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...γϛϡϨʔλͷ߹ͪΐͬͱ͢Δ ͱྑͦ͞͏
ऴΘΓ !