如何将我的Swift应用程序连接到我的Parse Server? [英] How to connect my Swift app to my Parse Server?
本文介绍了如何将我的Swift应用程序连接到我的Parse Server?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Swift语言将我的Parse应用程序连接到我的Node.js Parse Server.在Parse的文档中,我可以看到以下代码:
I'm working on connecting my Parse app to my Node.js Parse Server with the Swift language. In the documentation of Parse, I can see this code :
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
...
configuration.applicationId = @"YOUR_APP_ID";
configuration.clientKey = @"YOUR_APP_CLIENT_KEY";
configuration.server = @"http://localhost:1337/parse";
...
}]];
由于我使用的是Swift语言,因此到目前为止,这是我的配置:
And since I use the Swift language, here is my configuration until now :
// Initialize Parse.
Parse.setApplicationId("APP_ID", clientKey: "CLIENT_KEY")
但是如何像Objective-C代码中那样指定服务器?
But how can I specify the server as in the Objective-C code ?
谢谢!
推荐答案
我自己找到了答案,这是如何使用Swift设置配置(包括服务器URL):
Found the answer by myself, here is how to set a configuration (including the server URL) with Swift :
let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "APP_ID"
ParseMutableClientConfiguration.clientKey = "CLIENT_KEY"
ParseMutableClientConfiguration.server = "http://your_server.com:1337/parse"
})
Parse.initializeWithConfiguration(parseConfiguration)
希望它会对其他人有所帮助.
Hope it will help someone else.
这篇关于如何将我的Swift应用程序连接到我的Parse Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文