質問編集履歴
3
誤字修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -19,6 +19,10 @@
|
|
19
19
|
![](791e9e8ccf32b53d7eb6fa97a9a98d9c.png)
|
20
20
|
|
21
21
|
現状ですと上記のようにロック画面でのアクションがclearのみになっている。
|
22
|
+
|
23
|
+
ここに現れるボタンの編集がしたい。
|
24
|
+
|
25
|
+
|
22
26
|
|
23
27
|
(参照サイト http://qiita.com/mshrwtnb/items/3135e931eedc97479bb5)
|
24
28
|
|
@@ -157,11 +161,3 @@
|
|
157
161
|
}
|
158
162
|
|
159
163
|
```
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
###補足情報(言語/FW/ツール等のバージョンなど)
|
166
|
-
|
167
|
-
より詳細な情報
|
2
質問の詳細化
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,14 +8,160 @@
|
|
8
8
|
|
9
9
|
(参照 http://dev.classmethod.jp/references/ios8-notification-action/)
|
10
10
|
|
11
|
+
|
12
|
+
|
11
13
|
ロック画面でスライドした時に現れるボタンの編集がしたい。
|
12
14
|
|
13
15
|
|
14
16
|
|
15
17
|
###発生している問題・エラーメッセージ
|
16
18
|
|
19
|
+
![](791e9e8ccf32b53d7eb6fa97a9a98d9c.png)
|
20
|
+
|
21
|
+
現状ですと上記のようにロック画面でのアクションがclearのみになっている。
|
22
|
+
|
23
|
+
(参照サイト http://qiita.com/mshrwtnb/items/3135e931eedc97479bb5)
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
![](9e74670e8dc09c3e752c8dd6059ba1cb.png)
|
28
|
+
|
29
|
+
このようなアクション通知は実装できています。
|
30
|
+
|
17
31
|
|
18
32
|
|
19
33
|
言語:swift
|
20
34
|
|
21
35
|
User Notifications Frameworkを使って実装したいが、やり方がわからない。
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
###試したこと
|
42
|
+
|
43
|
+
AppDelegate.swift
|
44
|
+
|
45
|
+
```swift
|
46
|
+
|
47
|
+
func applicationDidEnterBackground(_ application: UIApplication) {
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
enum ActionIdentifier: String {
|
52
|
+
|
53
|
+
case attend
|
54
|
+
|
55
|
+
case absent
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
let attend = UNNotificationAction(identifier: ActionIdentifier.attend.rawValue,
|
62
|
+
|
63
|
+
title: "出席", options: [])
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
let absent = UNNotificationAction(identifier: ActionIdentifier.absent.rawValue,
|
68
|
+
|
69
|
+
title: "欠席",
|
70
|
+
|
71
|
+
options: [])
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
let category = UNNotificationCategory(identifier: "message", actions: [attend, absent], intentIdentifiers: [], options: [])
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
UNUserNotificationCenter.current().setNotificationCategories([category])
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
let content = UNMutableNotificationContent()
|
92
|
+
|
93
|
+
content.title = "出席確認"
|
94
|
+
|
95
|
+
content.body = "今日のイベントに参加しますか?"
|
96
|
+
|
97
|
+
content.sound = UNNotificationSound.default()
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
// categoryIdentifierを設定
|
102
|
+
|
103
|
+
content.categoryIdentifier = "message"
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
// 5秒後
|
108
|
+
|
109
|
+
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
|
110
|
+
|
111
|
+
let request = UNNotificationRequest(identifier: "FiveSecond",
|
112
|
+
|
113
|
+
content: content,
|
114
|
+
|
115
|
+
trigger: trigger)
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
@available(iOS 10.0, *)
|
124
|
+
|
125
|
+
func userNotificationCenter(_ center: UNUserNotificationCenter,
|
126
|
+
|
127
|
+
didReceive response: UNNotificationResponse,
|
128
|
+
|
129
|
+
withCompletionHandler completionHandler: () -> Void) {
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
switch response.actionIdentifier {
|
134
|
+
|
135
|
+
case ActionIdentifier.attend.rawValue:
|
136
|
+
|
137
|
+
debugPrint("出席します")
|
138
|
+
|
139
|
+
case ActionIdentifier.absent.rawValue:
|
140
|
+
|
141
|
+
debugPrint("欠席します")
|
142
|
+
|
143
|
+
default:
|
144
|
+
|
145
|
+
()
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
completionHandler()
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
###補足情報(言語/FW/ツール等のバージョンなど)
|
166
|
+
|
167
|
+
より詳細な情報
|
1
内容の詳細化
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
(参照 http://dev.classmethod.jp/references/ios8-notification-action/)
|
10
10
|
|
11
|
+
ロック画面でスライドした時に現れるボタンの編集がしたい。
|
12
|
+
|
11
13
|
|
12
14
|
|
13
15
|
###発生している問題・エラーメッセージ
|