13.10 アプリメインで結果を判別する
通知画面でボタンが押されるとアプリメイン画面が起動し、押されたボタンの識別子がアプリメイン画面のhandleActionWithIdentifier:forRemoteNotification:に渡されます。
識別子はペイロードデータ内のidentifierで指定した文字列です。
@interface InterfaceController()
@property (weak, nonatomic) IBOutlet WKInterfaceLabel *responseMessage;
@end
@implementation InterfaceController
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
}
- (void)willActivate {
[super willActivate];
}
- (void)didDeactivate {
[super didDeactivate];
}
- (void)handleActionWithIdentifier:(NSString *)identifier
forRemoteNotification:(UILocalNotification *)localNotification {
// 料理の希望について処理する
if([identifier isEqualToString:@"vote.izakayaButtonAction"]) {
[_responseMessage setText:@"居酒屋を選びました"];
}
if([identifier isEqualToString:@"vote.chineseButtonAction"]) {
[_resp
この記事は会員限定です。会員登録をすると続きをお読みいただけます。
ログイン / 新規登録