Upload
hao-lee
View
9
Download
0
Embed Size (px)
Citation preview
iOS
2016/04/21
iOS HTTP / HTTPS
Socket
XMPP
Telnet
......
HTTP GET
HEAD
POST
PUT
DELETE
HTTP
2xx
3xx
4xx
5xx
JSON
XML
Protobuf
JSON JavaScript Object Notation
MIME application/json
null
root JSONJSON
http://www.json.org/
http://www.json.org/
JSON Object
Object
JSON Array
Array
JSON Value
Value
JSONSerialization
iOS 5 JSON
Dictionary key String
JSON Data
JSONSerialization isValidJSONObject(_:)
JSON data
jsonObject(with:options:)
JSON Data JSON Object
data(withJSONObject:options:)
JSON Object JSON Data
SwiftyJSON
Swift
ATS
App Transport Security
iOS 9 (WWDC 2015, Session 711)
APP HTTPS
Info.plist NSAppTransportSecurity NSAllowsArbitraryLoads YES ATS
ATS
WWDC 2016, Session 706 2016 ATS ATS APP
2016/12 ATS
URL
schemehostportpath
String
URLRequest
allHTTPHeaderFields
httpMethod
httpBodyPOST
URLSession
dataTask(with:completionHandler:)
uploadTask(with:from:completionHandler:)
URLSessionTask
resume()
cancel()
GCD
Grand Central Dispatch
C
OperationOperationQueue
GCD
dispatch
Objective-C GCD
Swift 3 GCD Swift
DispatchQueue
main
global(qos:)
QoS
Quality of Service
DispatchQueue async(execute:)
() Closure
sync(execute:)
Closure
sync
https://github.com/kokuyoku82/SHULoginDemo
https://github.com/kokuyoku82/SHULoginDemo
http://54.215.139.77:8000
AWS
t2.micro
20
DynamoDB (NoSQL)
http://54.215.139.77:8000
API POST
/user/
Content-Type: application/json
JSON
emailpassword
201
API POST
/user/login
Content-Type: application/json
JSON
emailpassword
200
API
GET
/user/
200