質問編集履歴

7

文法の修正

2020/08/14 04:40

投稿

syooooring
syooooring

スコア0

test CHANGED
File without changes
test CHANGED
@@ -10,8 +10,6 @@
10
10
 
11
11
  https://qiita.com/kokogento/items/c3390f16895a76dbde70
12
12
 
13
- 唯一違うところは証明書ではなく、APNs認証キーを取得し、Firebaseにアップさせたことぐらいです。
14
-
15
13
  現在エラーが出ておらず、どこが間違っているのか全く分からない状態です。
16
14
 
17
15
  「どこを確認すべきなのか」だけでも教えていただきたいと思っております。

6

文法の修正

2020/08/14 04:40

投稿

syooooring
syooooring

スコア0

test CHANGED
File without changes
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  https://qiita.com/kokogento/items/c3390f16895a76dbde70
12
12
 
13
- 唯一違うところはp8の証明書ではなく、APNs認証キーを取得し、Firebaseにアップさせたことぐらいです。
13
+ 唯一違うところは証明書ではなく、APNs認証キーを取得し、Firebaseにアップさせたことぐらいです。
14
14
 
15
15
  現在エラーが出ておらず、どこが間違っているのか全く分からない状態です。
16
16
 

5

文法修正

2020/08/13 10:43

投稿

syooooring
syooooring

スコア0

test CHANGED
File without changes
test CHANGED
@@ -258,10 +258,6 @@
258
258
 
259
259
 
260
260
 
261
- 誤字脱字確認
262
-
263
-
264
-
265
261
  ### 補足情報(FW/ツールのバージョンなど)
266
262
 
267
263
  参考サイト

4

書式改善

2020/08/13 05:44

投稿

syooooring
syooooring

スコア0

test CHANGED
File without changes
test CHANGED
@@ -250,13 +250,13 @@
250
250
 
251
251
 
252
252
 
253
- Xcodeの設定の再確認
254
-
255
253
  pod fileインストール確認
256
254
 
257
255
  info.plistの設定確認
258
256
 
259
- GoogleService-info.plistの設定確認
257
+ GoogleService-info.plistをルートディレクトリにコピー済み
258
+
259
+
260
260
 
261
261
  誤字脱字確認
262
262
 

3

画像追加

2020/08/13 05:42

投稿

syooooring
syooooring

スコア0

test CHANGED
File without changes
test CHANGED
@@ -22,228 +22,228 @@
22
22
 
23
23
 
24
24
 
25
- ### 発生している問題・エラーメッセージ
25
+ ### Xcode、Firebaseの設定
26
+
27
+ FirebaseにAPNs認証キーアップロード済み
28
+
29
+ ![イメージ説明](c71e14f84261da598cfd47185ae5b82c.png)
30
+
31
+ Xcode側でプッシュ通知許可済み
32
+
33
+ ![イメージ説明](a70265a76d52afcfdbeb3d5c14fb0bee.png)
34
+
35
+
36
+
37
+ ### 該当のソースコード
38
+
39
+ AppDelegate.Swift
40
+
41
+
42
+
43
+ ```ここに言語名を入力
44
+
45
+ import UIKit
46
+
47
+ import Capacitor
48
+
49
+ import Firebase
50
+
51
+
52
+
53
+ @UIApplicationMain
54
+
55
+ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {
56
+
57
+
58
+
59
+ var window: UIWindow?
60
+
61
+
62
+
63
+
64
+
65
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
66
+
67
+ // Override point for customization after application launch.
68
+
69
+ FirebaseApp.configure()
70
+
71
+
72
+
73
+ if #available(iOS 10.0, *) {
74
+
75
+ // For iOS 10 display notification (sent via APNS)
76
+
77
+ UNUserNotificationCenter.current().delegate = self
78
+
79
+
80
+
81
+ let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
82
+
83
+ UNUserNotificationCenter.current().requestAuthorization(
84
+
85
+ options: authOptions,
86
+
87
+ completionHandler: {_, _ in })
88
+
89
+ } else {
90
+
91
+ let settings: UIUserNotificationSettings =
92
+
93
+ UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
94
+
95
+ application.registerUserNotificationSettings(settings)
96
+
97
+ }
98
+
99
+
100
+
101
+ application.registerForRemoteNotifications()
102
+
103
+
104
+
105
+ return true
106
+
107
+ }
108
+
109
+
110
+
111
+ func applicationWillResignActive(_ application: UIApplication) {
112
+
113
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
114
+
115
+ // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
116
+
117
+ }
118
+
119
+
120
+
121
+ func applicationDidEnterBackground(_ application: UIApplication) {
122
+
123
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
124
+
125
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
126
+
127
+ }
128
+
129
+
130
+
131
+ func applicationWillEnterForeground(_ application: UIApplication) {
132
+
133
+ // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
134
+
135
+ }
136
+
137
+
138
+
139
+ func applicationDidBecomeActive(_ application: UIApplication) {
140
+
141
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
142
+
143
+ }
144
+
145
+
146
+
147
+ func applicationWillTerminate(_ application: UIApplication) {
148
+
149
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
150
+
151
+ }
152
+
153
+
154
+
155
+ func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
156
+
157
+ // Called when the app was launched with a url. Feel free to add additional processing here,
158
+
159
+ // but if you want the App API to support tracking app url opens, make sure to keep this call
160
+
161
+ return CAPBridge.handleOpenUrl(url, options)
162
+
163
+ }
164
+
165
+
166
+
167
+ func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
168
+
169
+ // Called when the app was launched with an activity, including Universal Links.
170
+
171
+ // Feel free to add additional processing here, but if you want the App API to support
172
+
173
+ // tracking app url opens, make sure to keep this call
174
+
175
+ return CAPBridge.handleContinueActivity(userActivity, restorationHandler)
176
+
177
+ }
178
+
179
+
180
+
181
+ override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
182
+
183
+ super.touchesBegan(touches, with: event)
184
+
185
+
186
+
187
+ let statusBarRect = UIApplication.shared.statusBarFrame
188
+
189
+ guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return }
190
+
191
+
192
+
193
+ if statusBarRect.contains(touchPoint) {
194
+
195
+ NotificationCenter.default.post(CAPBridge.statusBarTappedNotification)
196
+
197
+ }
198
+
199
+ }
200
+
201
+
202
+
203
+ #if USE_PUSH
204
+
205
+
206
+
207
+ func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
208
+
209
+ Messaging.messaging().apnsToken = deviceToken
210
+
211
+ InstanceID.instanceID().instanceID { (result, error) in
212
+
213
+ if let error = error {
214
+
215
+ NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidFailToRegisterForRemoteNotificationsWithError.name()), object: error)
216
+
217
+ } else if let result = result {
218
+
219
+ NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidRegisterForRemoteNotificationsWithDeviceToken.name()), object: result.token)
220
+
221
+ }
222
+
223
+ }
224
+
225
+ }
226
+
227
+
228
+
229
+ func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
230
+
231
+ NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidFailToRegisterForRemoteNotificationsWithError.name()), object: error)
232
+
233
+ }
234
+
235
+
236
+
237
+ #endif
238
+
239
+
240
+
241
+ }
26
242
 
27
243
 
28
244
 
29
245
  ```
30
246
 
31
- FirebaseCloudMessagingを使い、プッシュ通知を送ってもios端末で通知が表示されない
32
-
33
- ```
34
-
35
-
36
-
37
- ### 該当のソースコード
38
-
39
- AppDelegate.Swift
40
-
41
-
42
-
43
- ```ここに言語名を入力
44
-
45
- import UIKit
46
-
47
- import Capacitor
48
-
49
- import Firebase
50
-
51
-
52
-
53
- @UIApplicationMain
54
-
55
- class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {
56
-
57
-
58
-
59
- var window: UIWindow?
60
-
61
-
62
-
63
-
64
-
65
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
66
-
67
- // Override point for customization after application launch.
68
-
69
- FirebaseApp.configure()
70
-
71
-
72
-
73
- if #available(iOS 10.0, *) {
74
-
75
- // For iOS 10 display notification (sent via APNS)
76
-
77
- UNUserNotificationCenter.current().delegate = self
78
-
79
-
80
-
81
- let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
82
-
83
- UNUserNotificationCenter.current().requestAuthorization(
84
-
85
- options: authOptions,
86
-
87
- completionHandler: {_, _ in })
88
-
89
- } else {
90
-
91
- let settings: UIUserNotificationSettings =
92
-
93
- UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
94
-
95
- application.registerUserNotificationSettings(settings)
96
-
97
- }
98
-
99
-
100
-
101
- application.registerForRemoteNotifications()
102
-
103
-
104
-
105
- return true
106
-
107
- }
108
-
109
-
110
-
111
- func applicationWillResignActive(_ application: UIApplication) {
112
-
113
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
114
-
115
- // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
116
-
117
- }
118
-
119
-
120
-
121
- func applicationDidEnterBackground(_ application: UIApplication) {
122
-
123
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
124
-
125
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
126
-
127
- }
128
-
129
-
130
-
131
- func applicationWillEnterForeground(_ application: UIApplication) {
132
-
133
- // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
134
-
135
- }
136
-
137
-
138
-
139
- func applicationDidBecomeActive(_ application: UIApplication) {
140
-
141
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
142
-
143
- }
144
-
145
-
146
-
147
- func applicationWillTerminate(_ application: UIApplication) {
148
-
149
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
150
-
151
- }
152
-
153
-
154
-
155
- func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
156
-
157
- // Called when the app was launched with a url. Feel free to add additional processing here,
158
-
159
- // but if you want the App API to support tracking app url opens, make sure to keep this call
160
-
161
- return CAPBridge.handleOpenUrl(url, options)
162
-
163
- }
164
-
165
-
166
-
167
- func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
168
-
169
- // Called when the app was launched with an activity, including Universal Links.
170
-
171
- // Feel free to add additional processing here, but if you want the App API to support
172
-
173
- // tracking app url opens, make sure to keep this call
174
-
175
- return CAPBridge.handleContinueActivity(userActivity, restorationHandler)
176
-
177
- }
178
-
179
-
180
-
181
- override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
182
-
183
- super.touchesBegan(touches, with: event)
184
-
185
-
186
-
187
- let statusBarRect = UIApplication.shared.statusBarFrame
188
-
189
- guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return }
190
-
191
-
192
-
193
- if statusBarRect.contains(touchPoint) {
194
-
195
- NotificationCenter.default.post(CAPBridge.statusBarTappedNotification)
196
-
197
- }
198
-
199
- }
200
-
201
-
202
-
203
- #if USE_PUSH
204
-
205
-
206
-
207
- func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
208
-
209
- Messaging.messaging().apnsToken = deviceToken
210
-
211
- InstanceID.instanceID().instanceID { (result, error) in
212
-
213
- if let error = error {
214
-
215
- NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidFailToRegisterForRemoteNotificationsWithError.name()), object: error)
216
-
217
- } else if let result = result {
218
-
219
- NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidRegisterForRemoteNotificationsWithDeviceToken.name()), object: result.token)
220
-
221
- }
222
-
223
- }
224
-
225
- }
226
-
227
-
228
-
229
- func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
230
-
231
- NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidFailToRegisterForRemoteNotificationsWithError.name()), object: error)
232
-
233
- }
234
-
235
-
236
-
237
- #endif
238
-
239
-
240
-
241
- }
242
-
243
-
244
-
245
- ```
246
-
247
247
 
248
248
 
249
249
  ### 試したこと

2

誤字修正

2020/08/12 03:03

投稿

syooooring
syooooring

スコア0

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  FirebaseCloudMessagingを使い、ionicでiosのプッシュ通知を実装させたいのですが、うまくいかず悩んでいます。
4
4
 
5
- プッシュ通知送信許可のメッセージは届くのですが、そ後通知を送っても受信きないという問題で
5
+ テスト端末にプッシュ通知送信許可のメッセージは届くので「許可」のです
6
+
7
+ 、その後通知を送っても受信できません。
6
8
 
7
9
  実装手順は下記の記事を参考に、ほぼ同じ手順で進めていました。
8
10
 
@@ -10,7 +12,7 @@
10
12
 
11
13
  唯一違うところはp8の証明書ではなく、APNs認証キーを取得し、Firebaseにアップさせたことぐらいです。
12
14
 
13
- 現在エラーが出ておらず、どこが間違っているのか全く分からない状態で苦しんでいます。
15
+ 現在エラーが出ておらず、どこが間違っているのか全く分からない状態です。
14
16
 
15
17
  「どこを確認すべきなのか」だけでも教えていただきたいと思っております。
16
18
 

1

誤字修正

2020/08/12 01:34

投稿

syooooring
syooooring

スコア0

test CHANGED
File without changes
test CHANGED
@@ -1,22 +1,18 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- FirebaseCloudMessagingを使い、iosのプッシュ通知を実装させたい
4
-
5
-
6
-
7
- FirebaseCloudMessagingを使い、ionicでiosのプッシュ通知を実装させたいのですが、うまくいかず苦しんでいます。
3
+ FirebaseCloudMessagingを使い、ionicでiosのプッシュ通知を実装させたいのですが、うまくいかずんでいます。
8
-
4
+
9
- 発生している問題としては、プッシュ通知送信許可のメッセージは届くが、その後通知を送っても受信できないという問題です。
5
+ プッシュ通知送信許可のメッセージは届くのですが、その後通知を送っても受信できないという問題です。
6
+
7
+ 実装手順は下記の記事を参考に、ほぼ同じ手順で進めていました。
10
8
 
11
9
  https://qiita.com/kokogento/items/c3390f16895a76dbde70
12
10
 
13
- 上記の記事とほぼ同じ手順で実装を進めていました。
14
-
15
11
  唯一違うところはp8の証明書ではなく、APNs認証キーを取得し、Firebaseにアップさせたことぐらいです。
16
12
 
17
13
  現在エラーが出ておらず、どこが間違っているのか全く分からない状態で苦しんでいます。
18
14
 
19
- 「どこを確認すべきなのか」だけでも教えていただきたいす。
15
+ 「どこを確認すべきなのか」だけでも教えていただきたいと思っております。
20
16
 
21
17
  AppDelegate.Swiftのソースも載せておきますのでご確認いただけると幸いです。
22
18
 
@@ -30,7 +26,7 @@
30
26
 
31
27
  ```
32
28
 
33
- プッシュ通知が受信できない
29
+ FirebaseCloudMessagingを使い、プッシュ通知を送ってもios端末で通知表示されない
34
30
 
35
31
  ```
36
32