As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Hi,
Have you tried to print the error object? What error are you getting?
Also, can you update the SDK and try the same code with latest Kinvey SDK v3.5.0? You might need to update Swift version for the same.
Regards,
Wani
Kinvey Support
Hi,
There is no error message. The function executes normally. What I need is a handler or something so the function waits until the file is downloaded to return the value.
Hello Emillio,
We are continuing to investigate this problem and I have just reached out to Engineering.
In the second paragraph of the problem description you make the following statement.
"The below code gives an error..."
Can you tell us what the error is that you are seeing. You said in your last update that there is no error message. If you are seeing an error, then what is the error, what happens?
Regards,
Billy Gee
Emilio Nieto
Hi,
In order to not be repeating the code everywhere I need to implement an object that returns a string from a query. How can I make the function to wait until the data is available?
The below code gives an error but if I move the return response after the query call the it will always return "" because it returns the value before the function has queried the values :(
Thanks,
import Foundation
import Kinvey
class DataManager {
var books=[filesMapping]();
var fileName:String = "";
func getIdforFile( ) -> String {
var response :String = "";
var responded:Bool = false;
let dataStore = DataStore<filesMapping>.collection(.network)
let predicateCompany = NSPredicate(format: "company == %@", "refreshments SA")
let predicateElement = NSPredicate(format: "element == %@", "character")
let predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [predicateCompany, predicateElement])
let query = Query(predicate: predicate)
dataStore.find(query ) { books, error in
if let books = books {
//succeed
print("Found file mapping");
response = books[0].fileID!;
return response;
} else {
response = "Error";
return response;
}
}
}
}