-
-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically changing parse server URL in iOS SDK #1390
Comments
This question has come up a few times in the past and I don't think there was ever an answer that allowed an app to re-initialize Parse without restarting the app. The solution that I've used to get around this is to externalize the subscription info on a separate route and based on the response initialize Parse with the appropriate server info. |
Could you instead, restrict the activity of ‘basic’ users on the same server as the premium users? Sent with GitHawk |
This issue has already been discussed in #1209, so could you close this. |
Technically it is possible to support both premium and basic on the same server. However, I want to dedicate the CPU power to premium users and re-direct basic users to a lower grade server. |
Thanks. This is a smart way to achieve the same outcome. This means that I need to "delay" parse initialisation until the app figure out the user category (externalised since I can't use any Parse cloud function for this purpose). |
Can iOS app switch between 2 parse-server dynamically without restarting the iOS App?
My usage scenario is as follows...
Currently my iOS App connects to parse-server on Heroku. I am planning to split my users into two groups: premium and basic. I have prepared two servers
https://abc1.server.com/parse
https://abc2.server.com/parse
I need to implement the logic to make to App connect to one of the two servers depending on the logon user profile. The app retrieves the logon user profile from the current parse-server and decide whether there is a need to switch to another server. Both servers point to the same database.
I had implemented the following logic and it works. However, it requires a force App restart because ParseClientConfiguration is initialised in the AppDelegate application:didFinishLaunchingWithOptions function. Can the app re-point to another parse-server without restarting the App?
Sample code to determine server URL.
if (User.Instance.IsPremium()) {
let config = ParseClientConfiguration { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "abc"
ParseMutableClientConfiguration.clientKey = "def"
ParseMutableClientConfiguration.server = "https://abc1.server.com/parse"
}
Parse.initialize(with: config)
} else {
let config = ParseClientConfiguration { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "abc"
ParseMutableClientConfiguration.clientKey = "def"
ParseMutableClientConfiguration.server = "https://abc2.server.com/parse"
}
Parse.initialize(with: config)
}
In my primary view controller, I added a restart app logic.
if (isServerURLChanged()) {
DisplayMessage(title:"App Restarting", message:"App restarting to switch to Premium/Free tier.")
}
The text was updated successfully, but these errors were encountered: