kumoh national institute of technology
Networked Systems Lab.

NUC Project Open Source

NSL > Researches> Industrial IoT> NUC Project Open Source
To receive recipe information from server
By :
Date : 2017-07-17
Views : 20

Func jsonParsingFromURL () {

let url_recipe = URL(string: "http://teamsf.co.kr:8520/GetRecipe"

let request = URLRequest(url: url_recipe!)

NSURLConnetion.sendAsynchronousRequest(request, queue: OperationQueue.main)

{(response, data, error) in

self.startParsing(data!)

}

}


func startParsing(_data : Data)

{

let dict: NSDictionary!=(try! JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers)) as! NSDictionary


var img_url = ""


for i in 1 ..< recipe_dict.count+1

{

let string = String(i)

each_recipe = recipe_dict[string] as ! NSDictionary

name_en_string = each_recipe.value(forKey: "name_en") as! NSString

name_string = each_recipe.value(forKey: "name") as! NSString

img_string = each_recipe.value(forKey: "image") as! NSString


img_url = urlforimage + (img_string as String)


recipeString = (name_string as String) + "+" + (name_en_string as String) + "+" + img_url

var Ary = RecipeString.components(separatedBy: "+")


RecipeStringAry.append(RecipeString)


name_array.append(Ary[0] as AnyObject)

name_ed_array.append(Ary[1] as AnyObject)

umg_array.append(Ary[2] as AnyObject)

}

tvJSON.reloadData()

}


 
Ʒ ̺
     
Ʒ  Bar code for melting function