質問編集履歴
1
ソースコードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,72 +52,8 @@
|
|
52
52
|
|
53
53
|
|
54
54
|
|
55
|
-
let request = NSMutableURLRequest(url: NSURL(string: "http://localhost/test.php")! as URL)
|
56
|
-
|
57
|
-
request.httpMethod = "POST"
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
|
62
|
-
|
63
|
-
request.httpBody = jsonData
|
64
|
-
|
65
|
-
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
|
66
|
-
|
67
|
-
request.addValue("application/json", forHTTPHeaderField: "Accept")
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
let task = URLSession.shared.dataTask(with: request as URLRequest){ data, response, error in
|
72
|
-
|
73
|
-
if error != nil{
|
74
|
-
|
75
|
-
print("Error 55 -> \(error)")
|
76
|
-
|
77
|
-
return
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
55
|
+
・・・
|
84
|
-
|
85
|
-
let result = try JSONSerialization.jsonObject(with: data!)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
print("Result 34 -> \(result)")
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
} catch {
|
94
|
-
|
95
|
-
print("Error 43-> \(error)")
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
|
-
task.resume()
|
102
|
-
|
103
|
-
}
|
104
|
-
|
105
|
-
catch {
|
106
|
-
|
107
|
-
print(error)
|
108
|
-
|
109
|
-
}
|
110
56
|
|
111
57
|
|
112
58
|
|
113
59
|
```
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
###補足情報
|
118
|
-
|
119
|
-
Xcode8.0beta2
|
120
|
-
|
121
|
-
PHP5.5.36
|
122
|
-
|
123
|
-
MAMP
|