質問編集履歴
2
誤字修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,171 +26,7 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
### 発生している問題・エラーメッセージ
|
30
29
|
|
31
|
-
エラー箇所
|
32
|
-
|
33
|
-
```
|
34
|
-
|
35
|
-
databaseRef.observeEventType(.childAdded, withBlock: { snapshot in
|
36
|
-
|
37
|
-
if let name = snapshot.value!.objectForKey("name") as? String,
|
38
|
-
|
39
|
-
message = snapshot.value!.objectForKey("message") as? String {
|
40
|
-
|
41
|
-
self.textView.text = "(self.textView.text)\n(name) : (message)"
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
})
|
46
|
-
|
47
|
-
```
|
48
|
-
|
49
|
-
エラー内容
|
50
|
-
|
51
|
-
```
|
52
|
-
|
53
|
-
'observeEventType(_:withBlock:)' has been renamed to 'observe(_:with:)'
|
54
|
-
|
55
|
-
Replace 'observeEventType(.childAdded, withBlock' with 'observe(.childAdded, with'
|
56
|
-
|
57
|
-
Expected expression in list of expressions
|
58
|
-
|
59
|
-
No exact matches in call to instance method 'observeEventType'
|
60
|
-
|
61
|
-
Result of call to 'observeEventType(_:withBlock:)' is unused
|
62
|
-
|
63
|
-
Value of type 'Any' has no member 'objectForKey'
|
64
|
-
|
65
|
-
Cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members
|
66
|
-
|
67
|
-
Expected 'let' in conditional
|
68
|
-
|
69
|
-
Insert 'let '
|
70
|
-
|
71
|
-
Value of type 'Any' has no member 'objectForKey'
|
72
|
-
|
73
|
-
Cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members
|
74
|
-
|
75
|
-
String interpolation produces a debug description for an optional value; did you mean to make this explicit?
|
76
|
-
|
77
|
-
Use 'String(describing:)' to silence this warning
|
78
|
-
|
79
|
-
Provide a default value to avoid this warning
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
```
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
### 該当のソースコード
|
94
|
-
|
95
|
-
```
|
96
|
-
|
97
|
-
import UIKit
|
98
|
-
|
99
|
-
import FirebaseCore
|
100
|
-
|
101
|
-
import Firebase
|
102
|
-
|
103
|
-
import FirebaseDatabase
|
104
|
-
|
105
|
-
import FirebaseStorage
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
class ViewController: UIViewController, UITextFieldDelegate {
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
@IBOutlet weak var textView: UITextView!
|
114
|
-
|
115
|
-
@IBOutlet weak var nameTextField: UITextField!
|
116
|
-
|
117
|
-
@IBOutlet weak var messageTextField: UITextField!
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
var ref:DatabaseReference!
|
122
|
-
|
123
|
-
var databaseRef:DatabaseReference!
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
override func viewDidLoad() {
|
128
|
-
|
129
|
-
super.viewDidLoad()
|
130
|
-
|
131
|
-
// Do any additional setup after loading the view.
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
databaseRef = Database.database().reference()
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
databaseRef.observeEventType(.childAdded, withBlock: { snapshot in
|
140
|
-
|
141
|
-
if let name = snapshot.value!.objectForKey("name") as? String,
|
142
|
-
|
143
|
-
message = snapshot.value!.objectForKey("message") as? String {
|
144
|
-
|
145
|
-
self.textView.text = "(self.textView.text)\n(name) : (message)"
|
146
|
-
|
147
|
-
}
|
148
|
-
|
149
|
-
})
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
func textFieldShouldReturn(_ textField: UITextField) -> Bool{
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
let messageData = ["name": nameTextField.text!, "message": messageTextField.text!]
|
166
|
-
|
167
|
-
databaseRef.childByAutoId().setValue(messageData)
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
textField.resignFirstResponder()
|
172
|
-
|
173
|
-
messageTextField.text = ""
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
FirebaseApp.configure()
|
178
|
-
|
179
|
-
return true
|
180
|
-
|
181
|
-
}
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
}
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
```
|
194
30
|
|
195
31
|
|
196
32
|
|
1
ソースコードとエラー文の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,9 +28,169 @@
|
|
28
28
|
|
29
29
|
### 発生している問題・エラーメッセージ
|
30
30
|
|
31
|
-
|
31
|
+
エラー箇所
|
32
|
+
|
32
|
-
|
33
|
+
```
|
34
|
+
|
35
|
+
databaseRef.observeEventType(.childAdded, withBlock: { snapshot in
|
36
|
+
|
37
|
+
if let name = snapshot.value!.objectForKey("name") as? String,
|
38
|
+
|
39
|
+
message = snapshot.value!.objectForKey("message") as? String {
|
40
|
+
|
41
|
+
self.textView.text = "(self.textView.text)\n(name) : (message)"
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
})
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
エラー内容
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
'observeEventType(_:withBlock:)' has been renamed to 'observe(_:with:)'
|
54
|
+
|
55
|
+
Replace 'observeEventType(.childAdded, withBlock' with 'observe(.childAdded, with'
|
56
|
+
|
57
|
+
Expected expression in list of expressions
|
58
|
+
|
59
|
+
No exact matches in call to instance method 'observeEventType'
|
60
|
+
|
61
|
+
Result of call to 'observeEventType(_:withBlock:)' is unused
|
62
|
+
|
63
|
+
Value of type 'Any' has no member 'objectForKey'
|
64
|
+
|
65
|
+
Cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members
|
66
|
+
|
67
|
+
Expected 'let' in conditional
|
68
|
+
|
69
|
+
Insert 'let '
|
70
|
+
|
71
|
+
Value of type 'Any' has no member 'objectForKey'
|
72
|
+
|
73
|
+
Cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members
|
74
|
+
|
75
|
+
String interpolation produces a debug description for an optional value; did you mean to make this explicit?
|
76
|
+
|
77
|
+
Use 'String(describing:)' to silence this warning
|
78
|
+
|
33
|
-
|
79
|
+
Provide a default value to avoid this warning
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
### 該当のソースコード
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
import UIKit
|
98
|
+
|
99
|
+
import FirebaseCore
|
100
|
+
|
101
|
+
import Firebase
|
102
|
+
|
103
|
+
import FirebaseDatabase
|
104
|
+
|
105
|
+
import FirebaseStorage
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
class ViewController: UIViewController, UITextFieldDelegate {
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
@IBOutlet weak var textView: UITextView!
|
114
|
+
|
115
|
+
@IBOutlet weak var nameTextField: UITextField!
|
116
|
+
|
117
|
+
@IBOutlet weak var messageTextField: UITextField!
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
var ref:DatabaseReference!
|
122
|
+
|
123
|
+
var databaseRef:DatabaseReference!
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
override func viewDidLoad() {
|
128
|
+
|
129
|
+
super.viewDidLoad()
|
130
|
+
|
131
|
+
// Do any additional setup after loading the view.
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
databaseRef = Database.database().reference()
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
databaseRef.observeEventType(.childAdded, withBlock: { snapshot in
|
140
|
+
|
141
|
+
if let name = snapshot.value!.objectForKey("name") as? String,
|
142
|
+
|
143
|
+
message = snapshot.value!.objectForKey("message") as? String {
|
144
|
+
|
145
|
+
self.textView.text = "(self.textView.text)\n(name) : (message)"
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
})
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
func textFieldShouldReturn(_ textField: UITextField) -> Bool{
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
let messageData = ["name": nameTextField.text!, "message": messageTextField.text!]
|
166
|
+
|
167
|
+
databaseRef.childByAutoId().setValue(messageData)
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
textField.resignFirstResponder()
|
172
|
+
|
173
|
+
messageTextField.text = ""
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
FirebaseApp.configure()
|
178
|
+
|
179
|
+
return true
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
```
|
34
194
|
|
35
195
|
|
36
196
|
|
@@ -48,6 +208,20 @@
|
|
48
208
|
|
49
209
|
|
50
210
|
|
211
|
+
追記
|
212
|
+
|
213
|
+
ソースコードとエラー箇所を記述しました。
|
214
|
+
|
215
|
+
エラー文を一つずつGoogle検索してみたのですがfixの通りにしない方が良いと書かれていたりして、
|
216
|
+
|
217
|
+
エラーを解決できませんでした。
|
218
|
+
|
219
|
+
どうにかお力添えをいただけないでしょうか?
|
220
|
+
|
221
|
+
何卒よろしくお願いいたします。
|
222
|
+
|
223
|
+
|
224
|
+
|
51
225
|
### 補足情報(FW/ツールのバージョンなど)
|
52
226
|
|
53
227
|
|