質問編集履歴

1

コンソール部分、プログラムの一部を修正

2018/06/05 00:05

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -38,11 +38,15 @@
38
38
 
39
39
  do {
40
40
 
41
+ let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments)
42
+
43
+ print(json)
44
+
41
45
  let decoder: JSONDecoder = JSONDecoder()
42
46
 
43
47
  do {
44
48
 
45
- let newJson: TranslationJson = try decoder.decode(TranslationJson.self, from: data)
49
+ let newJson: TranslationJson = try decoder.decode(TranslationJson.self, from: json as! Data)
46
50
 
47
51
  print(newJson) //Success!!!
48
52
 
@@ -52,7 +56,15 @@
52
56
 
53
57
  }
54
58
 
59
+
60
+
61
+
62
+
55
-
63
+ //let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments)
64
+
65
+
66
+
67
+
56
68
 
57
69
  } catch {
58
70
 
@@ -82,7 +94,37 @@
82
94
 
83
95
 
84
96
 
97
+
98
+
99
+ {
100
+
101
+ results = (
102
+
103
+ {
104
+
105
+ elevation = "3.06859827041626";
106
+
107
+ location = {
108
+
109
+ lat = "34.482902";
110
+
111
+ lng = "136.82661";
112
+
113
+ };
114
+
115
+ resolution = "9.543951988220215";
116
+
117
+ }
118
+
119
+ );
120
+
121
+ status = OK;
122
+
123
+ }
124
+
85
- <json convert failed in JSONDecoder The data couldn’t be read because it is missing.
125
+ Could not cast value of type '__NSDictionaryI' (0x101df1508) to 'NSData' (0x101df0090).
126
+
127
+ 2018-06-05 09:00:14.127686+0900 googleAPI[1744:118233] Could not cast value of type '__NSDictionaryI' (0x101df1508) to 'NSData' (0x101df0090).
86
128
 
87
129
  コンソールに上のように書いてありました。
88
130