类似于以下内容:
参考示例:
void changeString(ref String str) {
str = "def";
}
void main() {
String abc = "abc";
changeString(ref abc);
System.out.println(abc); //prints "def"
}
Run Code Online (Sandbox Code Playgroud)
例子:
void changeString(out String str) {
str = "def";
}
void main() {
String abc;
changeString(out abc);
System.out.println(abc); //prints "def"
}
Run Code Online (Sandbox Code Playgroud) 我正在使用:
compile "com.google.firebase:firebase-core:9.0.1"
compile "com.google.firebase:firebase-storage:9.0.1"
Run Code Online (Sandbox Code Playgroud)
这是我在设备离线(没有互联网)的情况下执行此代码的代码:
StorageReference mStorageRef = FirebaseStorage.getInstance().getReferenceFromUrl([MY_URL]);
mStorageRef.child("my_file.json").getBytes(Long.MAX_VALUE)
.addOnSuccessListener(bla bla bla).addOnFailureListener(more bla bla)
Run Code Online (Sandbox Code Playgroud)
我每秒都会在日志中重复此消息:
W/ExponenentialBackoff: network unavailable, sleeping.
E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.FirebaseApiNotAvailableException: firebase-auth is not linked, please fall back to unauthenticated mode.
Run Code Online (Sandbox Code Playgroud)
这是一个错误还是预期的行为?我知道,如果我离线,我将无法获取远程文件,但为什么firebase代码会尝试每秒轮询?
注意:当我再次上线时,它会执行成功/失败监听器并完成轮询.