我想把服务放在国际服上, 就超级简单做了2个按钮, 测试注册和登录, 竟然报错, 好奇怪, 国内服没问题的.
在main里面做了初始化, appid和appKey都是国际服的
LeanCloud.initialize(
appId,
appKey,
queryCache: LCQueryCache(),
);
然后在homepage里两个按钮上分别执行
Future register() async {
try {
LCUser user = LCUser();
user.username = 'xpcq199';
user.email = 'xpcq199@126.com';
user.password = '12345678';
LCUser u = await user.signUp();
debugPrint('注册成功, user: ${u.username}');
} on LCException catch (e) {
debugPrint('注册时遇到异常:code=${e.code}, message: ${e.message}');
}
}
Future loginByEmail() async {
try {
LCUser user = await LCUser.loginByEmail('xpcq199@126.com', '12345678');
debugPrint('登录成功, user: ${user.username}');
} on LCException catch (e) {
debugPrint('登录时遇到异常:code=${e.code}, message: ${e.message}');
}
}
报错显示:
_TypeError (type 'String' is not a subtype of type 'int' of 'index')
对应的plugin版本是leancloud_storage: ^0.7.10