The API said I would get an NSString. It contains a value *like* "iPhone" or "iPod touch"
I need to know which generation the iPod touch is, though
Why does that matter? Neither generation of iPod Touch can take a photo.
<b><a href="http://www.sdkcoder.com" target="_blank">www.sdkcoder.com</a></b><br />
<font size="1">Are my posts helping you? Please help support my forum!<br />
<i>Aiming to be one of the most comprehensive iPhone resources on the net.</i></font>
For some reason I had been thinking the new iPod Touch could! My bad!
What's weird though is my app was first rejected because it had a camera function and I made it available to all devices. I resubmitted it as iPhone/iPodTouch2G and it was approved...
For some reason I had been thinking the new iPod Touch could! My bad!
What's weird though is my app was first rejected because it had a camera function and I made it available to all devices. I resubmitted it as iPhone/iPodTouch2G and it was approved...
I've found that the app review process is inconsistent at best...
Chalk another one up for the WTF? pile.
<b><a href="http://www.sdkcoder.com" target="_blank">www.sdkcoder.com</a></b><br />
<font size="1">Are my posts helping you? Please help support my forum!<br />
<i>Aiming to be one of the most comprehensive iPhone resources on the net.</i></font>
Alternately, instead of testing for specific device models, you could simply test to see if the camera function is available using
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
...
}
and enable / disable that portion of your UI accordingly. That way you don't have to worry if they release new iPods with different model names or something like that...
I wanted to use: NSString *device = [[UIDevice currentDevice] model]; for detection on which device is the app installed, but if I try that on iPhone app crash (EXC_BAD_ACCESS), but if I try that on iPod Touch its works OK.
Know anybody where is the problem?
or find another way to get if the device has microphone or not. I`m using this part of code now:
There are probably something wrong with [device release]. If I deleted this lines with [device release] than its works OK. Can somebody explain to me how its works with the returned NSString object?
There are probably something wrong with [device release]. If I deleted this lines with [device release] than its works OK. Can somebody explain to me how its works with the returned NSString object?
You are not allocating the NSString 'device', so you are not responsible for releasing it.
thewittPosts: 180iPhone Dev SDK Supporter, Registered Users
edited December 2009
If possible you should really check for features and not for models. This keeps your application working when new products are released, and is a much more solid concept than tracking models and revisions.
If possible you should really check for features and not for models. This keeps your application working when new products are released, and is a much more solid concept than tracking models and revisions.
-t
Clearly, that's the better solution for most tasks, but the original question asks how to determine the device. I use this code myself. When a user logs in to my app, I simply make a note in a database as to which type of device they are using (more so for marketing purposes). Recording each feature's availability is over-kill (and sort of pointless) for what we want to do.
Replies
I need to know which generation the iPod touch is, though
Why does that matter? Neither generation of iPod Touch can take a photo.
<font size="1">Are my posts helping you? Please help support my forum!<br />
<i>Aiming to be one of the most comprehensive iPhone resources on the net.</i></font>
What's weird though is my app was first rejected because it had a camera function and I made it available to all devices. I resubmitted it as iPhone/iPodTouch2G and it was approved...
I've found that the app review process is inconsistent at best...
Chalk another one up for the WTF? pile.
<font size="1">Are my posts helping you? Please help support my forum!<br />
<i>Aiming to be one of the most comprehensive iPhone resources on the net.</i></font>
I wanted to use: NSString *device = [[UIDevice currentDevice] model]; for detection on which device is the app installed, but if I try that on iPhone app crash (EXC_BAD_ACCESS), but if I try that on iPod Touch its works OK.
Know anybody where is the problem?
or find another way to get if the device has microphone or not. I`m using this part of code now:
UIDeviceHardware.h
UIDeviceHardware.m
Implementation Code
Excellent post Dutch, just what I was looking for! Thanks
-t
Clearly, that's the better solution for most tasks, but the original question asks how to determine the device. I use this code myself. When a user logs in to my app, I simply make a note in a database as to which type of device they are using (more so for marketing purposes). Recording each feature's availability is over-kill (and sort of pointless) for what we want to do.