0

Does anyone have any experience with writing an application that can only be running once per user account?

i.e. on device A user X starts the application and logs in as himself on device B user Z also starts the same application but logs in using user X's credentials.

In this case I would like the app to say that it is already being used by User X.

This is the same model the spotify app has

So some particulars for my case. I'm using Parse as the back end. Its an iPad app specifically written in Swift.

Anyone tried this before?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 5
    You need to provide more detail for someone to be able to answer this for you. The solution to your problem depends heavily on which backend infrastructure you are (or are planning on) using. A common way of doing stuff like this is by utilizing access tokens. – oyvindhauge Sep 23 '15 at 13:38

1 Answers1

1

The key to this is that it has to be done in the back end. I assume that you were looking for help in architecturing this type of application and not asking for code.

Here is one option, if you have an external database, you could always track when someone logs in (in your example User X on device b) on their device. Every time you log someone one you can write it to a database and have it check to see if the user is already logged in (so if user z logs in with user x credentials). Something to keep in mind is that you may need to expire a user login and delete it from the table. You would also need to factor for if the user has multiple devices and its legitimately the same user but a different device.

logixologist
  • 3,694
  • 4
  • 28
  • 46
  • yep I understand this obviously needs back end support. I was looking understand the best events from iOS to know when a user is or is not using the application. Also whats the best way of knowing WHAT device they on e.g. Device A or Device B – waistcoat1971 Sep 23 '15 at 18:43
  • From a device A/B I believe you can get an identifier from iOS and maybe at login you could pass that in the db. – logixologist Sep 23 '15 at 19:01
  • Try this for getting a unique identifier. http://stackoverflow.com/questions/19402327/how-to-get-unique-id-in-ios-device – logixologist Sep 23 '15 at 19:10