Slide 1

Slide 1 text

Apple Watch meetup

Slide 2

Slide 2 text

https://github.com/kishikawakatsumi/ kishikawa katsumi at Realm Inc http://kishikawakatsumi.hatenablog.com/

Slide 3

Slide 3 text

Anime Today

Slide 4

Slide 4 text

Can send message to Watch App?

Slide 5

Slide 5 text

Watch App => Container App

Slide 6

Slide 6 text

Watch App => Container App + (BOOL)openParentApplication:(NSDictionary *)userInfo
 reply:(void (^)(NSDictionary *replyInfo, NSError *error))reply

Slide 7

Slide 7 text

Container App => Watch App

Slide 8

Slide 8 text

mutualmobile/MMWormhole

Slide 9

Slide 9 text

MMWormhole [self.wormhole passMessageObject:@{@"buttonNumber": @(1)} identifier:@"button"]; [self.wormhole listenForMessageWithIdentifier:@"button" listener:^(id messageObject) { self.numberLabel.text = [messageObject[@"buttonNumber"] stringValue]; }];

Slide 10

Slide 10 text

Darwin Notify Center

Slide 11

Slide 11 text

Darwin Notify Center - Based on the libnotify. - Cannot be passed "objects" - Cannot be passed "userInfo" - Always "deliver immediately"

Slide 12

Slide 12 text

Darwin Notify Center CFNotificationCenterRef const center = CFNotificationCenterGetDarwinNotifyCenter(); CFStringRef str = (__bridge CFStringRef)@"com.kishikawakatsumi.notification.test"; CFNotificationCenterAddObserver(center, (__bridge const void *)(self), notificationCallback, str, NULL, CFNotificationSuspensionBehaviorDeliverImmediately); void notificationCallback(CFNotificationCenterRef center, void * observer, CFStringRef name, void const * object, CFDictionaryRef userInfo) { ... }

Slide 13

Slide 13 text

App => Today Extension App => Keyboard Extension

Slide 14

Slide 14 text

App => Other Apps

Slide 15

Slide 15 text

notify_keys.h /* * File System notifications * These advise clients of various filesystem events. */ #define kNotifyVFSMount "com.apple.system.kernel.mount" #define kNotifyVFSUnmount "com.apple.system.kernel.unmount" #define kNotifyVFSUpdate "com.apple.system.kernel.mountupdate" #define kNotifyVFSLowDiskSpace "com.apple.system.lowdiskspace" #define kNotifyVFSLowDiskSpaceRootFS "com.apple.system.lowdiskspace.system" #define kNotifyVFSLowDiskSpaceOtherFS "com.apple.system.lowdiskspace.user"

Slide 16

Slide 16 text

com.apple.springboard.lockcomplete com.apple.springboard.ringerstate com.apple.springboard.deviceWillShutDown com.apple.springboard.lowPowerAlertPresented ...

Slide 17

Slide 17 text

Inter-Process Notifications on iOS http://realm.io/news/thomas-goyne-fast-inter-process-communication/ References