我需要向服务器发送许多变量。以前我使用的是这样的结构:
let myURL = NSURL(string: "http://example.com");
let request = NSMutableURLRequest(URL:myURL!);
request.HTTPMethod = "POST";
let postString = "param1=\(var1)¶m2=\(var2)"
request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding);
现在我不仅需要发送像param1和param2这样的变量,还需要发送很少的数组。我知道有一个名为Alamofire的库,但它不支持iOS 7.
答案 0 :(得分:1)
你可以这样做,
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
/* 1) Add the Gradle Retrolambda Plugin */
classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta3'
}
}
allprojects {
repositories {
jcenter()
/* 2) Add mavenCentral */
// mavenCentral()
/* 3) Add the Creative SDK Maven repo URL */
maven {
url 'https://repo.adobe.com/nexus/content/repositories/releases/'
}
maven {
url 'http://dl.bintray.com/raphaelbussa/maven'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
您可以根据需要使用数组而不是字典。希望这会有所帮助。 :)