在我的项目中,我创建了一个公共类来处理数据请求(JSON、图像等)的网络接口。类中的函数使用Alamofire来建立网络连接并下载JSON文件。
类和函数如下:
import Foundation
import Alamofire
public class DataConnectionManager {
public class func getJSON(AppModule:String, callback:(Int) -> Void) -> Void {
switch(AppModule) {
case "Newsfeed&
username, avatar , kills, deaths and played time
$noDigit = 0;
$hoursPlayed = 0;
$weHaveCSGO = 0;
$nullJsonresponse_1, true);
// Until here
if(isset($user['response']['players'][0]['steamid'])){
$nullJsontotal_rounds_played)*
username, avatar , kills, deaths and played time
$noDigit = 0;
$hoursPlayed = 0;
$weHaveCSGO = 0;
$nullJsonuuser, true);
// Until here
if(isset($user['response']['players'][0]['steamid'])){
$nullJsontotal_rounds_played)*100),