質問編集履歴
3
Capabilitiesを含む、現在の状況を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -140,6 +140,16 @@
|
|
140
140
|
|
141
141
|
|
142
142
|
|
143
|
+
### 現状
|
144
|
+
|
145
|
+
CapabilitiesにPush Notificationsを追加済み
|
146
|
+
|
147
|
+
通知自体は届くが、バナーや通知センターをタップしても画面遷移しない
|
148
|
+
|
149
|
+
ログを見る限り、View3のViewDidloadは動いている様子だが、実機テスト上には表示されていない
|
150
|
+
|
151
|
+
|
152
|
+
|
143
153
|
### 構造
|
144
154
|
|
145
155
|
TabController
|
2
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,7 +112,7 @@
|
|
112
112
|
|
113
113
|
let storyboard = UIStoryboard(name: "Main", bundle: nil)
|
114
114
|
|
115
|
-
let initialViewController = storyboard.instantiateViewController(withIdentifier: "
|
115
|
+
let initialViewController = storyboard.instantiateViewController(withIdentifier: "View3")
|
116
116
|
|
117
117
|
initialViewController.modalPresentationStyle = .overFullScreen
|
118
118
|
|
1
AppDelegateを全文記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,23 +16,103 @@
|
|
16
16
|
|
17
17
|
```Swift
|
18
18
|
|
19
|
+
@main
|
20
|
+
|
19
|
-
|
21
|
+
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
|
20
22
|
|
21
23
|
|
22
24
|
|
25
|
+
var window: UIWindow?
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
30
|
+
|
31
|
+
GMSServices.provideAPIKey("省略")
|
32
|
+
|
33
|
+
FirebaseApp.configure()
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
UNUserNotificationCenter.current().delegate = self
|
38
|
+
|
39
|
+
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
|
40
|
+
|
41
|
+
UNUserNotificationCenter.current().requestAuthorization(
|
42
|
+
|
43
|
+
options: authOptions,
|
44
|
+
|
45
|
+
completionHandler: {_, _ in })
|
46
|
+
|
47
|
+
application.registerForRemoteNotifications()
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
return true
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
// MARK: UISceneSession Lifecycle
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
|
23
|
-
func userNotificationCenter(_ center: UNUserNotificationCenter,
|
79
|
+
func userNotificationCenter(_ center: UNUserNotificationCenter,
|
80
|
+
|
81
|
+
willPresent notification: UNNotification,
|
82
|
+
|
83
|
+
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
if #available(iOS 14.0, *) {
|
88
|
+
|
89
|
+
completionHandler([[.badge, .banner]])
|
90
|
+
|
91
|
+
} else {
|
92
|
+
|
93
|
+
completionHandler([[.badge, .alert]])
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
func userNotificationCenter(_ center: UNUserNotificationCenter,
|
24
104
|
|
25
105
|
didReceive response: UNNotificationResponse,
|
26
106
|
|
27
107
|
withCompletionHandler completionHandler: @escaping () -> Void) {
|
28
108
|
|
29
|
-
|
109
|
+
|
30
110
|
|
31
111
|
self.window = UIWindow(frame: UIScreen.main.bounds)
|
32
112
|
|
33
113
|
let storyboard = UIStoryboard(name: "Main", bundle: nil)
|
34
114
|
|
35
|
-
let initialViewController = storyboard.instantiateViewController(withIdentifier: "V
|
115
|
+
let initialViewController = storyboard.instantiateViewController(withIdentifier: "SearchVC")
|
36
116
|
|
37
117
|
initialViewController.modalPresentationStyle = .overFullScreen
|
38
118
|
|
@@ -40,11 +120,21 @@
|
|
40
120
|
|
41
121
|
self.window?.makeKeyAndVisible()
|
42
122
|
|
123
|
+
|
124
|
+
|
125
|
+
completionHandler()
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
}
|
43
130
|
|
44
131
|
|
45
|
-
completionHandler()
|
46
132
|
|
47
133
|
}
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
48
138
|
|
49
139
|
```
|
50
140
|
|