gpt4 book ai didi

ios - 如何让 iOS 应用程序与我的 Parse Web 服务器通信?

转载 作者:搜寻专家 更新时间:2023-11-01 07:13:36 24 4
gpt4 key购买 nike

我有一个网络服务器,其中的解析服务器示例运行如下:

var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/nimbus',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'nimbus',
masterKey: process.env.MASTER_KEY || 'emory',
serverURL: process.env.SERVER_URL || 'http://locahost:5010/parse',
liveQuery: {
classNames: ["Users"]
}

现在,我还通过以下方式配置了我的 iOS 应用程序 (didFinishLaunching):

Parse.setApplicationId("nimbus", clientKey: "X")
let player = PFObject(className: "User")
player.setObject("Richard", forKey: "Name")
player.setObject("O", forKey: "Password")
player.saveInBackground { (succeeded, error) -> Void in
if succeeded {
print("Object Uploaded")
} else {
print("Error: \(error)")
}
}

然而,没有任何反应。如何将应用程序和我的服务器连接在一起?此外,由于 Parse 已经开源并放弃了托管,我可以使用任何 API key ,对吧?

最佳答案

How do I go about connecting the app and my server together?

连接 Parse iOS SDK你的应用程序与你的 Parse Server ,使用 ParseClientConfiguration 初始化您的 Parse SDK

例如:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

// Configuration of you parse application
let configuration = ParseClientConfiguration {
$0.applicationId = "MY_APP_ID" // Your App Id
$0.server = "https://example.com/api" // The URL of your server
}
Parse.initialize(with: configuration)

return true
}

I can use any API key right?

您不需要客户端 key 即可连接您的 Parse Server

希望我的回答对你有帮助

关于ios - 如何让 iOS 应用程序与我的 Parse Web 服务器通信?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43540513/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com