Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var theJSONText = ""
- dataToSend["trigger"] = ""
- dataToSend["gcm"] = ""
- dataToSend["client"] = "ios"
- dataToSend["deviceId"] =
- UIDevice.current.identifierForVendor!.uuidString
- dataToSend["deviceName"] = UIDevice.current.name
- dataToSend["login_source"] = loginSource
- dataToSend["lastsync"] = 0
- dataToSend["rows"] = []
- dataToSend["urlencode"] = true
- if let rows = rows {
- for row in rows {
- if row.syncRequired == 1 {
- rowsToSync.append(row)
- }
- }
- }
- rowsToSync.resultType = NSDictionary
- dataToSend["rows"] = rowsToSync
- print( dataToSend["rows"])
- if let theJSONData = try? JSONSerialization.data(
- withJSONObject: dataToSend,
- options: []) {
- theJSONText = String(data: theJSONData,
- encoding: .ascii)!
- print("JSON string = (theJSONText)")
- }
- params["data"] = theJSONText
- APIService.shared.syncUser(params: params) { (success, data, error) in
- if success{
- print("success in global sync")
- rows = data?.rows
- }else {
- print("failure in global sync")
- print(error?.errorMessage)
- }
- }
Add Comment
Please, Sign In to add comment