Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS中使用Firebase的云功能_Ios_Firebase_Swift3_Google Cloud Functions - Fatal编程技术网

在iOS中使用Firebase的云功能

在iOS中使用Firebase的云功能,ios,firebase,swift3,google-cloud-functions,Ios,Firebase,Swift3,Google Cloud Functions,我已经使用Node为Firebase编写了一个云函数 exports.fetchStudents = functions.https.onRequest((request, response) => { return admin.database().ref('Student').once('value', (snapshot) => { var students = snapshot.val(); response.send(students

我已经使用Node为Firebase编写了一个云函数

exports.fetchStudents = functions.https.onRequest((request, response) => {
    return admin.database().ref('Student').once('value', (snapshot) => {
        var students = snapshot.val();
        response.send(students)
        console.log(students)
    });
});
我已经在Firebase服务器和控制台上部署了它,我得到了期望的值。 我不想在iOS应用程序中使用此功能。我真的不知道如何在我的iOS应用程序中使用这些功能


谢谢

我已经做到了,这很容易。您需要的是在成功上传函数后点击CLI提供的url

函数URL(helloWorld):

用项目的id替换项目id

let url = URL(string:  "https://us-central1-project-id.cloudfunctions.net/fetchStudents")!

let urlReq = URLRequest(url: url)

let students = Alamofire.request(urlReq).validate().responseJSON { (response) in
         switch response.result{
           case .success(let value):
              completion(JSON(value), nil)
           case .failure(let error):
              completion(nil, String(describing: error))
        }
     }