我在Google控制台中收到此错误。
java.lang.IllegalArgumentException:at okhttp3.Headers $ Builder.checkNameAndValue(Headers.java:320)at at okhttp3.Headers $ Builder.add(Headers.java:270)at com.facebook.react.modules.network.NetworkingModule.extractHeaders (NetworkingModule.java:702)at com.facebook.react.modules.network.NetworkingModule.sendRequest (NetworkingModule.java:330)在java.lang.reflect.Method.invoke上 (原生方法)at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:160)at com.facebook.react.bridge.queue.NativeRunnable.run(原生方法)
在android.os.Handler.handleCallback(Handler.java:761)at android.os.Handler.dispatchMessage(Handler.java:98)at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:29)在android.os.Looper.loop (Looper.java:156)at com.facebook.react.bridge.queue.MessageQueueThreadImpl $ 3.run (MessageQueueThreadImpl.java:192)在java.lang.Thread.run (Thread.java:776)
环境:操作系统:macOS Sierra 10.12.6节点:8.6.0纱线:1.5.1 npm: 5.6.0守望者:4.9.0 Xcode:Xcode 9.0构建版本9A235 Android Studio:3.1 AI-173.4720617
包:(想要=>已安装)反应:16.3.1 => 16.3.1本地反应: 0.55.4 => 0.55.4
var DeviceInfo = require('react-native-device-info');
var deviceName = DeviceInfo.getDeviceName()
const apiLevel = DeviceInfo.getAPILevel()
const brand = DeviceInfo.getBrand()
const buildNumber = DeviceInfo.getBuildNumber()
const carrier = DeviceInfo.getCarrier()
const deviceCountry = DeviceInfo.getDeviceCountry()
const deviceLocale = DeviceInfo.getDeviceLocale()
const manufacturer = DeviceInfo.getManufacturer();
const model = DeviceInfo.getModel();
const readableVersion = DeviceInfo.getReadableVersion();
const serialNumber = DeviceInfo.getSerialNumber();
const systemName = DeviceInfo.getSystemName();
const systemVersion = DeviceInfo.getSystemVersion();
const uniqueId = DeviceInfo.getUniqueID();
const version = DeviceInfo.getVersion();
const isTablet = DeviceInfo.isTablet();
const isEmulator = DeviceInfo.isEmulator();
export const getCode = async (phone) => await axios({
method: 'post',
url: `${url}/api/mobile/external/code_send`,
headers: {
apiLevel,
brand,
buildNumber,
carrier,
deviceCountry,
deviceLocale,
deviceName,
manufacturer,
model,
readableVersion,
serialNumber,
systemName,
systemVersion,
uniqueId,
version,
isTablet,
isEmulator
},
data: {phone},
timeout: 10000,
});