Device reporting

Discussion in 'iOS Programming' started by 7on, Jan 11, 2012.

  1. 7on macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #1
    Hey all, we're building an internal iOS app for company deployment and I've been hitting a wall in regards to some device reporting (namely phone number and grabbing the OS version).

    We're planning on recording employee phone numbers and OS version for trouble shooting.

    Does Apple provide the API for such information?

    Thanks!
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    I know that the iOS version can be found, but I can't remember how and I don't think I've ever done it.

    The phone number for the device... I'm not so sure about. I'm pretty sure you can access the phone numbers for everyone they've listed as a contact, but I'm not so sure if you can find the users phone number by doing that...

    Sorry I'm not terribly useful
     
  3. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #3
    It's ok, I forgive you ;) I'll do more poking around for the iOS version. Maybe I can grab the UDID, that should be good enough (we already grab the phone number for the Android phones, just wanted to keep it consistent).
     
  4. phantax macrumors member

    Joined:
    Feb 2, 2009
    #4
    You used to be able to get the phone number from NSUserDefaults

    Code:
    NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];
    I believe using this is not 100% reliable as the number isn't read from the SIM, so you may get a null value back.

    Also, your app will get rejected for using this if you intend to put it in the App store. For an internal application it should be alright.

    I think your best bet would be to allow the user to select from the contact picker, or give them a numeric keyboard to enter their phone number the first time your app is launched.
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  6. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #6
    Oh nuts. Good to know. We are already capturing login details, but some employees might be using multiple phones/devices. I guess we'll actually have to TALK to the employees. Oh the humanity.

    Thanks for the code! I currently have no way of testing it without deploying it for beta testers (which the app isn't ready yet) because our dev iPhone isn't in service. But the checking for nil worked so that'll be something I look for in the testing phase.

    And don't worry, this is definitely just an internal app being deployed on company phones. The Android version is already out in beta testing, just trying to wrap my head around iOS development's more "interesting" aspects.
     
  7. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #7
    This might help. (Disclaimer: I haven't used this technique yet).
     
  8. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #8
    Thanks, I think I'll stick to phone number and then if nil just put a zero in the db. Thinking more about it the user already logs into the app, so we know the user so if the app returns nil then it's not the end of the world and 99% of the devices should have a phone number.

    What would be helpful is iOS version. If someone has an issue with the app and we can tell him that he needs to update his iPhone that would be handy.
     
  9. dejo, Jan 12, 2012
    Last edited: Jan 12, 2012

    dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    Code:
    [[UIDevice currentDevice] systemVersion]
    UIDevice Class Reference
     
  10. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #10
    Thanks kindly, works wonderfully. :)
     

Share This Page