Access control/Process monitor for iphone app

Discussion in 'iOS Programming' started by gamadeus, Feb 19, 2011.

  1. gamadeus macrumors newbie

    Joined:
    Feb 19, 2011
    #1
    I am thinking of a case where a 3rd party app connects over the network and affects changes in a server.
    If this app was downloaded to multiple devices, they could all simultaneously run the app and start modifying server-side data, maybe leading to race conditions too.
    Could I write some kind of background process for the iphone/ipad that would allow only a single device to run this app at a time in that network? What would it's features be?
    Thanks
     
  2. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #2
    Depending on how the clients interact with the server you are probably best off with some kind of lock.

    When one client needs exclusive access, check for the lock, then lock the server, raise a flag/create a file/create a record/..., do your job and then remove the lock.

    The details will depend on how the client and server interact.

    B
     
  3. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #3
    Many server side databases are designed to handle multithreaded access safely without data consistency hazards. Read up on databases (locks, atomic commits, and etc.) and choose an appropriate DB.
     
  4. gamadeus thread starter macrumors newbie

    Joined:
    Feb 19, 2011
    #4
    Thanks. That would work except, the server in my case is a black box. It belongs to the same vendor who wrote the app. I was looking for a way to still maintain single access to the server from outside.
    Guess I could configure the network, but I'd really prefer something on the client devices side.
    If I had a monitor that started at bootup on the device, it would be application agnostic too, so I could use it to maintain access for any app on the device.
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    So, you're trying to update the remote database of someone else's app? Do you have permission to do that?
     
  6. gamadeus thread starter macrumors newbie

    Joined:
    Feb 19, 2011
    #6
    Actually no.
    I do not want to bother about the remote side.
    Was seeing if this is possible entirely on the client devices' side with a separate process monitor kind of app. That way if you and I have an iphone and you launch the app, the monitoring app could log usage on my local db and prompt me that the actual app is in use when I also try to launch it from my device.
     
  7. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #7
    There are no "process monitor" apps on iPhone, unless you jailbreak. Attempting to write one would violate the terms of app store, and would be impossible without a jailbreak on the device anyway, because all apps are isolated from one another by default. This inter-app isolation isn't a user setting; it's enforced for all apps under all circumstances. The only way around it is to jailbreak the phone.

    That means you're left with writing an app of your own, that does something more than monitor other apps (processes). Obviously, it's your app, so it can contact any server you write it for, and coordinate with that server using whatever mechanism you write it for. The right way would be to write it to avoid race conditions in the first place. There are several ways of doing that.

    If your app on some other iPhone has already coordinated with your server, and told it the app is running on that phone, then it's up to your server to make that information available to your app running on other iPhones. There are several ways of doing that.

    If you're just trying to observe other apps and coordinate that info using some server (yours or someone else's), then you can't do that without a jailbreak on each and every phone where the app runs.
     
  8. KnightWRX macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #8
    Maybe you should just ask them to implement multi-client access safety then. And why do you suspect that it isn't already implemented that way anyhow ?

    You're paying this vendor for this solution, you should not have to write code to make it work. That's what you're paying the vendor for.
     
  9. gamadeus thread starter macrumors newbie

    Joined:
    Feb 19, 2011
    #9
    Good points.
    Based on testing with multiple devices, I was able to concurrently control the remote box with the vendor app from each device. So it is apparent that they have not implemented any kind of locking in their implementation.

    Interesting to know about Apple policy associated with process monitoring on the phone. Is this the case even for enterprise licenses for intra-company apps?

    Based on some looking up earlier, this api link about monitoring arbitrary processes seemed somewhat close to what I was thinking of. Do you see any limitations that I can't spot here?

    You know how painful it can be with feature requests directed at vendors and following up on it. It's just like being in queue for healthcare in Canada.
     
  10. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #10
  11. gamadeus thread starter macrumors newbie

    Joined:
    Feb 19, 2011
    #11
    got it.
    Thanks everyone this was really useful.
     
  12. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #12
    Did you actually find a solution, or just abandon this train of thought?

    B
     
  13. gamadeus thread starter macrumors newbie

    Joined:
    Feb 19, 2011
    #13
    One more thought was to have my own app do all the heavy lifting required and then launch this vendor app in question from within, but need to inquire if they publish a URL scheme. Unlikely I think.

    This has hit a dead end. Planning to talk this over with them and explore options. Will let you know if I manage something out of this.
     

Share This Page