iOS Device reporting

7on

macrumors 601
Original poster
Nov 9, 2003
4,939
0
Dress Rosa
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!
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,660
4,200
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
 
Comment

7on

macrumors 601
Original poster
Nov 9, 2003
4,939
0
Dress Rosa
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
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).
 
Comment

phantax

macrumors member
Feb 2, 2009
72
0
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.
 
Comment

7on

macrumors 601
Original poster
Nov 9, 2003
4,939
0
Dress Rosa
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.

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.
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.
 
Comment

7on

macrumors 601
Original poster
Nov 9, 2003
4,939
0
Dress Rosa
This might help. (Disclaimer: I haven't used this technique yet).
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.
 
Comment

Similar threads

  • gimmesomemo
1
Replies
1
Views
717
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.