Alamofire对参数的定义:
/// A dictionary of parameters to apply to a URLRequest.
public typealias Parameters = [String: Any]
参数用于对URL请求进行编码。
我正在使用的API有一个PUT端点,希望将帖子正文格式化为
[[String: Any]]
有人有办法提供正确的编码吗?感谢。
编辑:如果这不符合正常的JSON编码标准,请提供一个链接,我可以用来向负责我的API规范的人员证明我的情况。再次感谢。
答案 0 :(得分:1)
Alamofire并未内置对此类参数的支持,但您可以在使用Alamofire发布之前将其编码到URLRequest
中,或者将SessionManager
的扩展名编写为可以使用的URLRequest
该表单的参数并使用您自己的参数编码器来创建apply plugin: 'com.android.application'
repositories {
mavenLocal()
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
android {
signingConfigs {
config {
keyAlias 'key1'
keyPassword '*****'
storeFile file('C:/Users/marco/.android/debug.keystore')
storePassword 'android'
}
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
multiDexEnabled true
applicationId "net.panomaps"
minSdkVersion 21
targetSdkVersion 27
versionCode 63
versionName "5.3.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.firebase:firebase-config:15.0.2'
implementation 'com.google.firebase:firebase-invites:15.0.1'
implementation 'pub.devrel:easypermissions:1.1.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'org.xwalk:xwalk_core_library:23.53.589.4'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-auth:3.1.3'
implementation 'com.firebaseui:firebase-ui:3.1.3'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.github.Q42:AndroidScrollingImageView:1.3.2'
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
// error message -> Cannot create variant 'android-manifest-metadata' after configuration ':app:debugApiElements' has been resolved
。