質問編集履歴
1
コンソール部分、プログラムの一部を修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,14 +18,20 @@
|
|
18
18
|
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
19
19
|
if let data = data{
|
20
20
|
do {
|
21
|
+
let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments)
|
22
|
+
print(json)
|
21
23
|
let decoder: JSONDecoder = JSONDecoder()
|
22
24
|
do {
|
23
|
-
let newJson: TranslationJson = try decoder.decode(TranslationJson.self, from:
|
25
|
+
let newJson: TranslationJson = try decoder.decode(TranslationJson.self, from: json as! Data)
|
24
26
|
print(newJson) //Success!!!
|
25
27
|
} catch {
|
26
28
|
print("json convert failed in JSONDecoder", error.localizedDescription)
|
27
29
|
}
|
30
|
+
|
31
|
+
|
28
|
-
|
32
|
+
//let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments)
|
33
|
+
|
34
|
+
|
29
35
|
} catch {
|
30
36
|
print("Serialize Error")
|
31
37
|
}
|
@@ -40,7 +46,22 @@
|
|
40
46
|
|
41
47
|
|
42
48
|
|
49
|
+
|
50
|
+
{
|
51
|
+
results = (
|
52
|
+
{
|
53
|
+
elevation = "3.06859827041626";
|
54
|
+
location = {
|
55
|
+
lat = "34.482902";
|
56
|
+
lng = "136.82661";
|
57
|
+
};
|
58
|
+
resolution = "9.543951988220215";
|
59
|
+
}
|
60
|
+
);
|
61
|
+
status = OK;
|
62
|
+
}
|
43
|
-
|
63
|
+
Could not cast value of type '__NSDictionaryI' (0x101df1508) to 'NSData' (0x101df0090).
|
64
|
+
2018-06-05 09:00:14.127686+0900 googleAPI[1744:118233] Could not cast value of type '__NSDictionaryI' (0x101df1508) to 'NSData' (0x101df0090).
|
44
65
|
コンソールに上のように書いてありました。
|
45
66
|
|
46
67
|
|