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
920
Other Decks in Programming
See All in Programming
Desafios e Lições Aprendidas na Migração de Monólitos para Microsserviços em Java
jessilyneh
2
150
LangChainの現在とv0.3にむけて
os1ma
4
920
全部見せます! クラシルリワードのSwiftTesting移行プロジェクト
uetyo
0
210
仮想ファイルシステムを導入して開発環境のストレージ課題を解消する
segadevtech
2
550
Modern Angular with the NGRX Signal Store New Rules for Your Architecture @BASTA! 2024 in Mainz
manfredsteyer
PRO
0
140
How to Break into Reading Open Source
kaspth
2
210
unique パッケージから学ぶ interning と weak reference @ Asakusa.go#3
karamaru
2
810
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
4
90k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
0
120
Amazon BedrockでサーバレスなAIお料理ボットを作成する!!
tosuri13
0
230
Why Prism?
kddnewton
4
1.7k
Scala におけるコンパイラエラーとの付き合い方
chencmd
2
430
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
85
5.6k
The Brand Is Dead. Long Live the Brand.
mthomps
53
38k
The Pragmatic Product Professional
lauravandoore
31
6.2k
Building a Scalable Design System with Sketch
lauravandoore
459
32k
For a Future-Friendly Web
brad_frost
174
9.3k
Building Flexible Design Systems
yeseniaperezcruz
325
38k
Debugging Ruby Performance
tmm1
72
12k
What's new in Ruby 2.0
geeforr
340
31k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
In The Pink: A Labor of Love
frogandcode
139
22k
From Idea to $5000 a Month in 5 Months
shpigford
379
46k
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...γϛϡϨʔλͷ߹ͪΐͬͱ͢Δ ͱྑͦ͞͏
ऴΘΓ !