I am going to create an application in ipad in which I don't want to manage the session on server side to avoid the server calls.
So, how can I create and maintain the session in the application locally.
Related
I want to get back some response to browser from application.
Like if I come into application from browser to application using deeplinking then I handle some changes into application and I want to retrive those changes into browser from application.
So help me how it is possible.
That's not possible. What you can do if you need to interact with a web site is to present the user a web view inside your app. That's actually a good practice since you don't send the user outside of your app.
The web view has some delegate methods were you can catch requests and linking.
You can deal with URL schemes by adding them in your website and make your app handle them. You can pass information in the URL and retrieve it in your app by parsing the URL.
Is it possible to initialize Parse configuration more than once in the app through a button?
The scenario is, Add a button inside a ViewController. When clicking, the app switches from my current live parse server to the testing server and vice versa.
Taking into consideration that the app cannot be killed and forced to restart as stated in apple documentation.
You have 2 options:
With Parse IOS SDK - Parse client is a singleton means that you can create only one instance of it. If you don't mind that users will need to close and open your app what you can do is to use NSUserDefaults there you can save the mode of the client (Test or Prod). Again... Users will need to manually restart the app.
Without Parse IOS SDK - it can be done (without restarting the app) only if you will create a custom REST client that will work against Parse REST API. In this way you can create as many client as you want and each client will have it's own configurations.
I have authorization in my app that happens through POST-request to the server. In response I receive json file and cookie.
I want prevent user to enter credentials every time. So the question is how to store cookies (session only cookie) between app launches. I concern here 3 cases:
User pressed "Home" and returned to the app before app was terminated by iOS
User pressed "Home" and returned to the app after app was terminated by iOS
User forced quit from app by swiping-out it from multitasking
It seems that i can use something like this:
NSHTTPCookieStorage.sharedHTTPCookieStorage().cookiesForURL(NSURL(string: "url")!)
But is it secure and will it persist in case 2 and case 3?
I've been working on similar iOS issues for the past few weeks.
Depending upon just how secure the credentials need to be, I'd suggest looking into using the browser's localStorage functionality to resolve this, rather than using cookies.
localStorage and sessionStorage are far easier to manipulate than cookies, and cross domain protections help avoid both user manipulation and 3rd party attempts.
If one was dealing with almost any other browser, one would generally use sessionStorage, since the values are preserved per log on session. But, iOS on mobile devices wil purge session storage far too frequently, rendering it useless.
The danger of using localStorage is that values persist between browser sessions. Where this becomes an issue is if a legit user logs in from a 3rd party device, the credentials are retained on that device unless the user has a way purging them (which is easy to accomplish using javascript).
The advantages of using sessionStorage and localStorage are:
1. ease of manipulation compared to cookies
2. no need to keep posting back cookies values to the server
3. less server overhead
note that on iOS in particular, if Private Browsing is enabled, both session and local storage are disabled.
Is it possible to create an IOS Background Service ? Can it also be accessible from other applications?
Not without jailbraking the phone. And most certainly not for distributing over the AppStore.
You could create an application (with UI) that would be accessible to other applications via custom URL schemes (you could even set URL callbacks with the same mechanisms).
But it would be up to the user if they would decide to run or kill this app. It would not be a typical 'background task'.
We have built a iOS application and we are going to submit it to App store. Inside our app we have hardcoded the url of the webservice.
Our client wants to do something like this.
For the review he wants set that url to the webservice in the dev and after approval to change it to production. As he doesn't want to create fake accounts and data in the production database.
Is there any setting or something to do such a thing for the approval without changing our code.
Thanks
Hardcode a specific URL in your app. Then setup your web server so that URL gets redirected to the "real" URL. Before your app is in the store, have the URL redirect to the development URL. Once your app has been approved and it goes live, change the URL to redirect to the production URL.
This is basically a single line change in the web server's config file.
This gets a little trickier if you need to repeat the process each time you submit an update. You probably will want the review of the update to go back to the development URL. This will probably required that you pass a version number as part of the URL (which you should do anyway incase the API of your URL changes over time).
You can check whether on not the app is in AppStore. Check out this answer for more info: https://stackoverflow.com/a/17627239/2604030
I am hoping you haven't also hardcoded a password in there.
However, unless this is a very long-term, robust service, also hardcoding your database server details in there is also a bit dangerous.
Consider writing them to NSUserDefaults but having a failover service.
For example, if the server doesn't respond, have a different server you can hit to get a new database server address.
This would allow you to setup a test server, kill it after review, and have new users go to the new server.
Another approach is, if you have a way to push notifications to the devices or have a status check that they do, add extra metadata to that check message so you can pass through an update to the server address.
Querying a separate server for important metadata is a common technique - it lets you have some flexibility and respond to emergencies.
Why not just KISS and set the URL in NSUserDefaults or a plist (i.e. validation=URL1, validated=URL2 or something). This way your URL is configuration-based and not embedded in your code. You could use Sebyddd's response in your code to determine which URL you grab at runtime